Skip to main content

Seadragon.Strings class

Version 0.8.8 - Back to Seadragon Ajax API Reference


This static class defines all user-facing strings so that they may be tweaked and localized as needed. It also provides support for string arguments. The strings are static properties of this class as nested objects, but they should only be accessed via the getString() method so that missing strings and missing arguments can be properly handled.

Static Properties

Note that all dot-separated properties are actually nested subproperties. This means that Seadragon.Strings.Errors.Failure is valid, but Seadragon.Strings["Errors.Failure"] is not.

Errors.FailureStringShown when the user's browser does not support Seadragon. Expects no arguments.
Errors.DzcStringShown when an image file is in fact a Deep Zoom Collection. Expects no arguments.
Errors.DziStringShown when an image file is not a valid Deep Zoom Image. Expects no arguments.
Errors.XmlStringShown when an image file is not well-formed XML. Expects no arguments.
Errors.EmptyStringShown when the empty string is given as an image URL. Expects no arguments.
Errors.ImageFormatStringShown when an image uses an unsupported image format, e.g. WDP. Expects one argument: the uppercase image format.
Errors.SecurityStringShown when an image cannot be opened due to browser cross-site security restrictions. Expects no arguments.
Errors.StatusStringShown when an image returns a non-200 HTTP status code. Expects two arguments: the status code, and the capitalized status text.
Errors.UnknownStringShown when there is an unknown error while attempting to open an image. Expects no arguments.
Messages.LoadingStringShown when an image has been loading for a noticeable amount of time. Expects no arguments.
Tooltips.FullPageStringShown as the tooltip for the Full Page button.
Tooltips.HomeStringShown as the tooltip for the Home button.
Tooltips.ZoomInStringShown as the tooltip for the Zoom In button.
Tooltips.ZoomOutStringShown as the tooltip for the Zoom Out button.

Static Methods

Name and SignatureReturn TypeDescription
getString(name, ...)StringReturns the string for the given name, formatted with the given arguments. Uses the empty string in place of any missing arguments, and returns the empty string if no string with the given name exists.
setString(name, value)-Sets the string with the given name to the given value. This string can contain numbered argument placeholders in the form of "{0}", "{1}", etc. Creates static properties where necessary.

Example Usage

The following code alerts the Errors.Status string, passing in a non-200 status code and its corresponding status text as arguments.

if (statusCode != 200) {
statusCode, statusText));

The following code sets a new string to be shown for a custom pan control. It expects arguments for the amount of pan in each dimension.

        "Currently panning {0} pixels by {1} pixels...");