Add jquery.i18n library, version 1.0.4
https://github.com/wikimedia/jquery.i18n
This commit is contained in:
parent
b46c5a7b4e
commit
ebbafd5977
21
licenses/jquery.i18n.LICENSE.txt
Normal file
21
licenses/jquery.i18n.LICENSE.txt
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) 2012-2013 Santhosh Thottingal and other
|
||||
contributors. See CREDITS for a list.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -345,6 +345,11 @@ function init() {
|
||||
"externals/jsoneditor/jsoneditor.js",
|
||||
"externals/select2/select2.min.js",
|
||||
"externals/jquery.lavalamp.min.js",
|
||||
"externals/jquery.i18n.messagestore.js",
|
||||
"externals/jquery.i18n.emitter.js",
|
||||
"externals/jquery.i18n.parser.js",
|
||||
"externals/jquery.i18n.emitter.js",
|
||||
"externals/jquery.i18n.language.js",
|
||||
|
||||
"scripts/util/misc.js",
|
||||
"scripts/util/url.js",
|
||||
@ -429,6 +434,10 @@ function init() {
|
||||
"externals/imgareaselect/jquery.imgareaselect.js",
|
||||
"externals/date.js",
|
||||
"externals/jquery.i18n.js",
|
||||
"externals/jquery.i18n.messagestore.js",
|
||||
"externals/jquery.i18n.parser.js",
|
||||
"externals/jquery.i18n.emitter.js",
|
||||
"externals/jquery.i18n.language.js",
|
||||
"externals/underscore-min.js",
|
||||
"externals/jsoneditor/jsoneditor.js",
|
||||
|
||||
@ -541,6 +550,10 @@ function init() {
|
||||
"externals/imgareaselect/jquery.imgareaselect.js",
|
||||
"externals/date.js",
|
||||
"externals/jquery.i18n.js",
|
||||
"externals/jquery.i18n.messagestore.js",
|
||||
"externals/jquery.i18n.parser.js",
|
||||
"externals/jquery.i18n.emitter.js",
|
||||
"externals/jquery.i18n.language.js",
|
||||
"externals/underscore-min.js",
|
||||
"scripts/preferences.js",
|
||||
]
|
||||
|
1
main/webapp/modules/core/externals/jquery.i18n.emitter.js
vendored
Normal file
1
main/webapp/modules/core/externals/jquery.i18n.emitter.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(e){"use strict";var n=function(){this.language=e.i18n.languages[String.locale]||e.i18n.languages.default};n.prototype={constructor:n,emit:function(n,r){var t,a,u,i=this;switch(typeof n){case"string":case"number":t=n;break;case"object":if(a=e.map(n.slice(1),function(e){return i.emit(e,r)}),u=n[0].toLowerCase(),"function"!=typeof i[u])throw new Error('unknown operation "'+u+'"');t=i[u](a,r);break;case"undefined":t="";break;default:throw new Error("unexpected type in AST: "+typeof n)}return t},concat:function(n){var r="";return e.each(n,function(e,n){r+=n}),r},replace:function(e,n){var r=parseInt(e[0],10);return r<n.length?n[r]:"$"+(r+1)},plural:function(e){var n=parseFloat(this.language.convertNumber(e[0],10)),r=e.slice(1);return r.length?this.language.convertPlural(n,r):""},gender:function(e){var n=e[0],r=e.slice(1);return this.language.gender(n,r)},grammar:function(e){var n=e[0],r=e[1];return r&&n&&this.language.convertGrammar(r,n)}},e.extend(e.i18n.parser.emitter,new n)}(jQuery);
|
@ -1,4 +1,4 @@
|
||||
/*! jQuery based internationalization library, Copyright 2010 Dave Perrett, http://recursive-design.com/
|
||||
* Released under the MIT license -- https://opensource.org/licenses/MIT */
|
||||
(function(f){f.i18n={dict:null,plural:null,setDictionary:function(a){null===this.dict?this.dict=a:f.extend(this.dict,a)},setPlural:function(a){this.plural=a},_p:function(a,d,e){var c=this.dict[a],b=[];b.push(e);if(void 0===c||null===this.plural)return this.printf(1<e?d:a,b);a=this.plural.replace(/n%/g,e+"%");eval(a);return this.printf(c[plural],b)},_:function(a,d){var e=a;this.dict&&this.dict[a]&&(e=this.dict[a]);return this.printf(e,d)},printf:function(a,d){if(!d)return a;for(var e="",c=/%(\d+)\$s/g,
|
||||
b=c.exec(a);b;){var f=parseInt(b[1],10)-1;a=a.replace("%"+b[1]+"$s",d[f]);b=c.exec(a)}c=a.split("%s");if(1<c.length)for(b=0;b<d.length;b++)0<c[b].length&&c[b].lastIndexOf("%")==c[b].length-1&&(c[b]+="s"+c.splice(b+1,1)[0]),e+=c[b]+d[b];return e+c[c.length-1]}};f.fn._t=function(a,d){return f(this).text(f.i18n._(a,d))}})(jQuery);
|
||||
/* jQuery Internationalization library 1.0.4
|
||||
* Copyright (C) 2012 Santhosh Thottingal
|
||||
* Dual licensed GPLv2 or later and MIT. */
|
||||
!function(e){"use strict";var n,a,o=Array.prototype.slice;(a=function(n){this.options=e.extend({},a.defaults,n),this.parser=this.options.parser,this.locale=this.options.locale,this.messageStore=this.options.messageStore,this.languages={},this.init()}).prototype={init:function(){var n=this;String.locale=n.locale,String.prototype.toLocaleString=function(){var a,o,t,i,l,r,s;for(t=this.valueOf(),i=n.locale,l=0;i;){o=(a=i.split("-")).length;do{if(r=a.slice(0,o).join("-"),s=n.messageStore.get(r,t))return s;o--}while(o);if("en"===i)break;i=e.i18n.fallbacks[n.locale]&&e.i18n.fallbacks[n.locale][l]||n.options.fallbackLocale,e.i18n.log("Trying fallback locale for "+n.locale+": "+i),l++}return""}},destroy:function(){e.removeData(document,"i18n")},load:function(n,a){var o,t,i,l={};if(n||a||(n="i18n/"+e.i18n().locale+".json",a=e.i18n().locale),"string"==typeof n&&"json"!==n.split(".").pop()){l[a]=n+"/"+a+".json",o=(e.i18n.fallbacks[a]||[]).concat(this.options.fallbackLocale);for(t in o)l[i=o[t]]=n+"/"+i+".json";return this.load(l)}return this.messageStore.load(n,a)},parse:function(n,a){var o=n.toLocaleString();return this.parser.language=e.i18n.languages[e.i18n().locale]||e.i18n.languages.default,""===o&&(o=n),this.parser.parse(o,a)}},e.i18n=function(n,t){var i,l=e.data(document,"i18n"),r="object"==typeof n&&n;return r&&r.locale&&l&&l.locale!==r.locale&&(String.locale=l.locale=r.locale),l||(l=new a(r),e.data(document,"i18n",l)),"string"==typeof n?(i=void 0!==t?o.call(arguments,1):[],l.parse(n,i)):l},e.fn.i18n=function(){var n=e.data(document,"i18n");return n||(n=new a,e.data(document,"i18n",n)),String.locale=n.locale,this.each(function(){var a=e(this),o=a.data("i18n");o?a.text(n.parse(o)):a.find("[data-i18n]").i18n()})},String.locale=String.locale||e("html").attr("lang"),String.locale||(void 0!==typeof window.navigator?(n=window.navigator,String.locale=n.language||n.userLanguage||""):String.locale=""),e.i18n.languages={},e.i18n.messageStore=e.i18n.messageStore||{},e.i18n.parser={parse:function(e,n){return e.replace(/\$(\d+)/g,function(e,a){var o=parseInt(a,10)-1;return void 0!==n[o]?n[o]:"$"+a})},emitter:{}},e.i18n.fallbacks={},e.i18n.debug=!1,e.i18n.log=function(){window.console&&e.i18n.debug&&window.console.log.apply(window.console,arguments)},a.defaults={locale:String.locale,fallbackLocale:"en",parser:e.i18n.parser,messageStore:e.i18n.messageStore},e.i18n.constructor=a}(jQuery);
|
||||
|
4
main/webapp/modules/core/externals/jquery.i18n.language.js
vendored
Normal file
4
main/webapp/modules/core/externals/jquery.i18n.language.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
main/webapp/modules/core/externals/jquery.i18n.messagestore.js
vendored
Normal file
4
main/webapp/modules/core/externals/jquery.i18n.messagestore.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/* jQuery Internationalization library 1.0.4
|
||||
* Copyright (C) 2012 Santhosh Thottingal
|
||||
* Dual licensed GPLv2 or later and MIT. */
|
||||
!function(e,s,t){"use strict";function n(s){var t=e.Deferred();return e.getJSON(s).done(t.resolve).fail(function(n,r,o){e.i18n.log("Error in loading messages from "+s+" Exception: "+o),t.resolve()}),t.promise()}var r=function(){this.messages={},this.sources={}};r.prototype={load:function(s,t){var r=null,o=[],i=this;if("string"==typeof s)return e.i18n.log("Loading messages from: "+s),n(s).done(function(e){i.set(t,e)}).promise();if(t)return i.set(t,s),e.Deferred().resolve();for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t=r,o.push(i.load(s[r],t)));return e.when.apply(e,o)},set:function(s,t){this.messages[s]?this.messages[s]=e.extend(this.messages[s],t):this.messages[s]=t},get:function(e,s){return this.messages[e]&&this.messages[e][s]}},e.extend(e.i18n.messageStore,new r)}(jQuery,window);
|
4
main/webapp/modules/core/externals/jquery.i18n.parser.js
vendored
Normal file
4
main/webapp/modules/core/externals/jquery.i18n.parser.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/* jQuery Internationalization library 1.0.4
|
||||
* Copyright (C) 2012 Santhosh Thottingal
|
||||
* Dual licensed GPLv2 or later and MIT. */
|
||||
!function(n){"use strict";var r=function(r){this.options=n.extend({},n.i18n.parser.defaults,r),this.language=n.i18n.languages[String.locale]||n.i18n.languages.default,this.emitter=n.i18n.parser.emitter};r.prototype={constructor:r,simpleParse:function(n,r){return n.replace(/\$(\d+)/g,function(n,t){var u=parseInt(t,10)-1;return void 0!==r[u]?r[u]:"$"+t})},parse:function(r,t){return r.indexOf("{{")<0?this.simpleParse(r,t):(this.emitter.language=n.i18n.languages[n.i18n().locale]||n.i18n.languages.default,this.emitter.emit(this.ast(r),t))},ast:function(n){function r(n){return function(){var r,t;for(r=0;r<n.length;r++)if(null!==(t=n[r]()))return t;return null}}function t(n){var r,t,u=F,l=[];for(r=0;r<n.length;r++){if(null===(t=n[r]()))return F=u,null;l.push(t)}return l}function u(n,r){return function(){for(var t=F,u=[],l=r();null!==l;)u.push(l),l=r();return u.length<n?(F=t,null):u}}function l(r){var t=r.length;return function(){var u=null;return n.substr(F,t)===r&&(u=r,F+=t),u}}function e(r){return function(){var t=n.substr(F).match(r);return null===t?null:(F+=t[0].length,t[0])}}function i(){var n=t([h,p]);return null===n?null:n[1]}function a(){var n=t([d,m]);return null===n?null:["REPLACE",parseInt(n[1],10)-1]}function o(){var n,r=t([g,u(0,b)]);return null===r?null:(n=r[1]).length>1?["CONCAT"].concat(n):n[0]}function c(){var n=t([w,v,a]);return null===n?null:[n[0],n[2]]}function f(){var n=t([w,v,b]);return null===n?null:[n[0],n[2]]}function s(){var n=t([E,j,O]);return null===n?null:n[1]}var g,v,h,p,d,m,$,x,C,A,P,j,w,E,O,S,b,y,F=0;if(g=l("|"),v=l(":"),h=l("\\"),p=e(/^./),d=l("$"),m=e(/^\d+/),$=e(/^[^{}\[\]$\\]/),x=e(/^[^{}\[\]$\\|]/),C=e(/^[^{}\[\]$\s]/),r([i,C]),A=r([i,x]),P=r([i,$]),w=function(n,r){return function(){var t=n();return null===t?null:r(t)}}(e(/^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/),function(n){return n.toString()}),j=r([function(){var n=t([r([c,f]),u(0,o)]);return null===n?null:n[0].concat(n[1])},function(){var n=t([w,u(0,o)]);return null===n?null:[n[0]].concat(n[1])}]),E=l("{{"),O=l("}}"),S=r([s,a,function(){var n=u(1,P)();return null===n?null:n.join("")}]),b=r([s,a,function(){var n=u(1,A)();return null===n?null:n.join("")}]),null===(y=function(){var n=u(0,S)();return null===n?null:["CONCAT"].concat(n)}())||F!==n.length)throw new Error("Parse error at position "+F.toString()+" in input: "+n);return y}},n.extend(n.i18n.parser,new r)}(jQuery);
|
Loading…
Reference in New Issue
Block a user