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.
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.
Name | Type | Description |
---|---|---|
Errors.Failure | String | Shown when the user's browser does not support Seadragon. Expects no arguments. |
Errors.Dzc | String | Shown when an image file is in fact a Deep Zoom Collection. Expects no arguments. |
Errors.Dzi | String | Shown when an image file is not a valid Deep Zoom Image. Expects no arguments. |
Errors.Xml | String | Shown when an image file is not well-formed XML. Expects no arguments. |
Errors.Empty | String | Shown when the empty string is given as an image URL. Expects no arguments. |
Errors.ImageFormat | String | Shown when an image uses an unsupported image format, e.g. WDP. Expects one argument: the uppercase image format. |
Errors.Security | String | Shown when an image cannot be opened due to browser cross-site security restrictions. Expects no arguments. |
Errors.Status | String | Shown when an image returns a non-200 HTTP status code. Expects two arguments: the status code, and the capitalized status text. |
Errors.Unknown | String | Shown when there is an unknown error while attempting to open an image. Expects no arguments. |
Messages.Loading | String | Shown when an image has been loading for a noticeable amount of time. Expects no arguments. |
Tooltips.FullPage | String | Shown as the tooltip for the Full Page button. |
Tooltips.Home | String | Shown as the tooltip for the Home button. |
Tooltips.ZoomIn | String | Shown as the tooltip for the Zoom In button. |
Tooltips.ZoomOut | String | Shown as the tooltip for the Zoom Out button. |
Name and Signature | Return Type | Description |
---|---|---|
getString(name, ...) | String | Returns 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. |
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) { alert(Seadragon.Strings.getString("Errors.Status", 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.
Seadragon.Strings.setString("PanControl.CurrentPan", "Currently panning {0} pixels by {1} pixels...");