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-04-03 11:08:27 +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.",
|
|
|
|
ImageFormat: "Sorry, we don't support {0}-based Deep Zoom Images.",
|
|
|
|
Security: "It looks like a security restriction stopped us from " +
|
|
|
|
"loading this Deep Zoom Image.",
|
2013-04-25 08:23:02 +04:00
|
|
|
Status: "This space unintentionally left blank ({0} {1})."
|
2011-12-06 07:50:25 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
Tooltips: {
|
2012-04-03 11:08:27 +04:00
|
|
|
FullPage: "Toggle full page",
|
|
|
|
Home: "Go home",
|
|
|
|
ZoomIn: "Zoom in",
|
|
|
|
ZoomOut: "Zoom out",
|
|
|
|
NextPage: "Next page",
|
|
|
|
PreviousPage: "Previous page"
|
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-04-03 11:08:27 +04:00
|
|
|
string = null,
|
2012-01-12 03:22:13 +04:00
|
|
|
args = arguments,
|
|
|
|
i;
|
|
|
|
|
|
|
|
for ( i = 0; i < props.length; i++ ) {
|
2012-04-03 11:08:27 +04:00
|
|
|
// in case not a subproperty
|
|
|
|
string = I18N[ props[ i ] ] || {};
|
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) {
|
2013-02-13 07:40:08 +04:00
|
|
|
var i = parseInt( capture.match( /\d+/ ), 10 ) + 1;
|
2012-01-12 03:22:13 +04:00
|
|
|
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 ));
|