2011-12-06 07:50:25 +04:00
|
|
|
|
|
|
|
(function( $ ){
|
|
|
|
|
2012-01-12 03:22:13 +04:00
|
|
|
//TODO: I guess this is where the i18n needs to be reimplemented. I'll look
|
|
|
|
// into existing patterns for i18n in javascript but i think that mimicking
|
|
|
|
// pythons gettext might be a reasonable approach.
|
2012-01-24 07:48:45 +04:00
|
|
|
var I18N = {
|
2011-12-06 07:50:25 +04:00
|
|
|
Errors: {
|
2012-01-12 03:22:13 +04:00
|
|
|
Failure: "Sorry, but Seadragon Ajax can't run on your browser!\n" +
|
2011-12-06 07:50:25 +04:00
|
|
|
"Please try using IE 7 or Firefox 3.\n",
|
2012-01-12 03:22:13 +04:00
|
|
|
Dzc: "Sorry, we don't support Deep Zoom Collections!",
|
|
|
|
Dzi: "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
|
|
|
|
Xml: "Hmm, this doesn't appear to be a valid Deep Zoom Image.",
|
|
|
|
Empty: "You asked us to open nothing, so we did just that.",
|
2011-12-06 07:50:25 +04:00
|
|
|
ImageFormat: "Sorry, we don't support {0}-based Deep Zoom Images.",
|
2012-01-12 03:22:13 +04:00
|
|
|
Security: "It looks like a security restriction stopped us from " +
|
2011-12-06 07:50:25 +04:00
|
|
|
"loading this Deep Zoom Image.",
|
2012-01-12 03:22:13 +04:00
|
|
|
Status: "This space unintentionally left blank ({0} {1}).",
|
|
|
|
Unknown: "Whoops, something inexplicably went wrong. Sorry!"
|
2011-12-06 07:50:25 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
Messages: {
|
2012-01-12 03:22:13 +04:00
|
|
|
Loading: "Loading..."
|
2011-12-06 07:50:25 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
Tooltips: {
|
2012-01-12 03:22:13 +04:00
|
|
|
FullPage: "Toggle full page",
|
|
|
|
Home: "Go home",
|
|
|
|
ZoomIn: "Zoom in",
|
|
|
|
ZoomOut: "Zoom out"
|
2012-01-24 07:48:45 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$.extend( $, {
|
2011-12-06 07:50:25 +04:00
|
|
|
|
2012-02-15 23:50:27 +04:00
|
|
|
/**
|
|
|
|
* @function
|
|
|
|
* @name OpenSeadragon.getString
|
|
|
|
* @param {String} property
|
|
|
|
*/
|
2012-01-12 03:22:13 +04:00
|
|
|
getString: function( prop ) {
|
|
|
|
|
|
|
|
var props = prop.split('.'),
|
2012-01-24 07:48:45 +04:00
|
|
|
string = I18N,
|
2012-01-12 03:22:13 +04:00
|
|
|
args = arguments,
|
|
|
|
i;
|
|
|
|
|
|
|
|
for ( i = 0; i < props.length; i++ ) {
|
|
|
|
string = string[ props[ i ] ] || {}; // in case not a subproperty
|
2011-12-06 07:50:25 +04:00
|
|
|
}
|
|
|
|
|
2012-01-12 03:22:13 +04:00
|
|
|
if ( typeof( string ) != "string" ) {
|
2011-12-06 07:50:25 +04:00
|
|
|
string = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
return string.replace(/\{\d+\}/g, function(capture) {
|
2012-01-12 03:22:13 +04:00
|
|
|
var i = parseInt( capture.match( /\d+/ ) ) + 1;
|
|
|
|
return i < args.length ?
|
|
|
|
args[ i ] :
|
|
|
|
"";
|
2011-12-06 07:50:25 +04:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2012-02-15 23:50:27 +04:00
|
|
|
/**
|
|
|
|
* @function
|
|
|
|
* @name OpenSeadragon.setString
|
|
|
|
* @param {String} property
|
|
|
|
* @param {*} value
|
|
|
|
*/
|
2012-01-12 03:22:13 +04:00
|
|
|
setString: function( prop, value ) {
|
|
|
|
|
|
|
|
var props = prop.split('.'),
|
|
|
|
container = $.Strings,
|
|
|
|
i;
|
2011-12-06 07:50:25 +04:00
|
|
|
|
2012-01-12 03:22:13 +04:00
|
|
|
for ( i = 0; i < props.length - 1; i++ ) {
|
|
|
|
if ( !container[ props[ i ] ] ) {
|
|
|
|
container[ props[ i ] ] = {};
|
2011-12-06 07:50:25 +04:00
|
|
|
}
|
2012-01-12 03:22:13 +04:00
|
|
|
container = container[ props[ i ] ];
|
2011-12-06 07:50:25 +04:00
|
|
|
}
|
|
|
|
|
2012-01-12 03:22:13 +04:00
|
|
|
container[ props[ i ] ] = value;
|
2011-12-06 07:50:25 +04:00
|
|
|
}
|
|
|
|
|
2012-01-24 07:48:45 +04:00
|
|
|
});
|
2011-12-06 07:50:25 +04:00
|
|
|
|
|
|
|
}( OpenSeadragon ));
|