silverstripe-framework/javascript/i18nx.js
Sam Minnee 08a5a7c387 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72803 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-10 22:08:52 +00:00

40 lines
913 B
JavaScript

if(typeof(ss) == 'undefined') ss = {};
/**
* Stub implementation for ss.i18n code.
* Use instead of sapphire/javascript/i18n.js
* if you want to use any SilverStripe javascript
* without internationalization support.
*/
ss.i18n = {
currentLocale: 'en_US',
defaultLocale: 'en_US',
_t: function (entity, fallbackString, priority, context) {
return fallbackString;
},
sprintf: function(S) {
if (arguments.length == 1) return S;
var nS = "";
var tS = S.split("%s");
var args = [];
for (var i=1, len = arguments.length; i <len; ++i) {
args.push(arguments[i]);
};
for(var i=0; i<args.length; i++) {
if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != args.length-1)
tS[i] += "s"+tS.splice(i+1,1)[0];
nS += tS[i] + args[i];
}
return nS + tS[tS.length-1];
},
// stub methods
addDictionary: function() {},
getDictionary: function() {}
};