pome-ui 2.0.0-preview10 → 2.0.0-preview12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pome-localization.js +8 -5
- package/pome-localization.min.js +1 -1
- package/pome-ui.dev.js +8 -4
- package/pome-ui.dev.min.js +1 -1
- package/pome-ui.js +8 -4
- package/pome-ui.min.js +1 -1
package/package.json
CHANGED
package/pome-localization.js
CHANGED
|
@@ -71,11 +71,13 @@ function create() {
|
|
|
71
71
|
|
|
72
72
|
var key = arguments[0];
|
|
73
73
|
var val = key;
|
|
74
|
+
var foundInOverrides = false;
|
|
74
75
|
if (this.overrides[this.getCurrentLocale()]) {
|
|
75
|
-
val = this.overrides[this.getCurrentLocale()][key]
|
|
76
|
+
val = this.overrides[this.getCurrentLocale()][key];
|
|
77
|
+
foundInOverrides = true;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
if (!
|
|
80
|
+
if (!foundInOverrides && this.texts[key]) {
|
|
79
81
|
val = this.texts[key];
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -86,12 +88,13 @@ function create() {
|
|
|
86
88
|
return val;
|
|
87
89
|
},
|
|
88
90
|
setLocalizedString(locales, key, val) {
|
|
91
|
+
var self = this;
|
|
89
92
|
locales.forEach(function (locale) {
|
|
90
|
-
if (!
|
|
91
|
-
|
|
93
|
+
if (!self.overrides[locale]) {
|
|
94
|
+
self.overrides[locale] = {};
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
self.overrides[locale][key] = val;
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
100
|
};
|
package/pome-localization.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function create(){var r=null;return{locales:{},texts:{},overrides:{},getCurrentLocale(){return r},addLocale(e,t,l){if(!t){var a=e.lastIndexOf("/");if(a<0){t=e}else{t=e.substr(e,a+1)}t=t.split(".")[0]}if(typeof t=="string"){this.locales[t]=e}else if(t instanceof Array){for(var r=0;r<t.length;++r){this.locales[t[r]]=e}}if(l){this.locales["fallback"]=e}},setLocale(e){if(!e){e=!window.localStorage.locale?window.navigator.language:window.localStorage.locale}if(!this.locales[e]){e="fallback"}if(!this.locales[e]){throw"No available translations for the locale"}r=e;this.texts=require(this.locales[e]).texts;if(this.locales["fallback"]){if(this.locales[e]!=this.locales["fallback"]){var t=require(this.locales["fallback"]).texts;var l=Object.getOwnPropertyNames(t);var a=this;l.forEach(function(e){if(!a.texts[e]){a.texts[e]=t[e]}})}}},sr(){if(arguments.length==0){return null}var e=arguments[0];var t=e;if(this.overrides[this.getCurrentLocale()]){t=this.overrides[this.getCurrentLocale()][e]}if(!
|
|
1
|
+
function create(){var r=null;return{locales:{},texts:{},overrides:{},getCurrentLocale(){return r},addLocale(e,t,l){if(!t){var a=e.lastIndexOf("/");if(a<0){t=e}else{t=e.substr(e,a+1)}t=t.split(".")[0]}if(typeof t=="string"){this.locales[t]=e}else if(t instanceof Array){for(var r=0;r<t.length;++r){this.locales[t[r]]=e}}if(l){this.locales["fallback"]=e}},setLocale(e){if(!e){e=!window.localStorage.locale?window.navigator.language:window.localStorage.locale}if(!this.locales[e]){e="fallback"}if(!this.locales[e]){throw"No available translations for the locale"}r=e;this.texts=require(this.locales[e]).texts;if(this.locales["fallback"]){if(this.locales[e]!=this.locales["fallback"]){var t=require(this.locales["fallback"]).texts;var l=Object.getOwnPropertyNames(t);var a=this;l.forEach(function(e){if(!a.texts[e]){a.texts[e]=t[e]}})}}},sr(){if(arguments.length==0){return null}var e=arguments[0];var t=e;var l=false;if(this.overrides[this.getCurrentLocale()]){t=this.overrides[this.getCurrentLocale()][e];l=true}if(!l&&this.texts[e]){t=this.texts[e]}for(var a=1;a<arguments.length;++a){t=t.replaceAll(`{${a-1}}`,arguments[a])}return t},setLocalizedString(e,t,l){var a=this;e.forEach(function(e){if(!a.overrides[e]){a.overrides[e]={}}a.overrides[e][t]=l})}}}exports.create=create;
|
package/pome-ui.dev.js
CHANGED
|
@@ -17352,8 +17352,9 @@ function build(options, exports) {
|
|
|
17352
17352
|
p1 = Promise.resolve();
|
|
17353
17353
|
}
|
|
17354
17354
|
|
|
17355
|
+
var self = this;
|
|
17355
17356
|
return p1.then(function () {
|
|
17356
|
-
var p2 = addin.created.call(
|
|
17357
|
+
var p2 = addin.created.call(self);
|
|
17357
17358
|
if (!p2 instanceof Promise) {
|
|
17358
17359
|
p2 = Promise.resolve();
|
|
17359
17360
|
}
|
|
@@ -17370,8 +17371,9 @@ function build(options, exports) {
|
|
|
17370
17371
|
p1 = Promise.resolve();
|
|
17371
17372
|
}
|
|
17372
17373
|
|
|
17374
|
+
var self = this;
|
|
17373
17375
|
return p1.then(function () {
|
|
17374
|
-
var p2 = addin.mounted.call(
|
|
17376
|
+
var p2 = addin.mounted.call(self);
|
|
17375
17377
|
if (!p2 instanceof Promise) {
|
|
17376
17378
|
p2 = Promise.resolve();
|
|
17377
17379
|
}
|
|
@@ -17388,8 +17390,9 @@ function build(options, exports) {
|
|
|
17388
17390
|
p1 = Promise.resolve();
|
|
17389
17391
|
}
|
|
17390
17392
|
|
|
17393
|
+
var self = this;
|
|
17391
17394
|
return p1.then(function () {
|
|
17392
|
-
var p2 = addin.unmounted.call(
|
|
17395
|
+
var p2 = addin.unmounted.call(self);
|
|
17393
17396
|
if (!p2 instanceof Promise) {
|
|
17394
17397
|
p2 = Promise.resolve();
|
|
17395
17398
|
}
|
|
@@ -17406,8 +17409,9 @@ function build(options, exports) {
|
|
|
17406
17409
|
p1 = Promise.resolve();
|
|
17407
17410
|
}
|
|
17408
17411
|
|
|
17412
|
+
var self = this;
|
|
17409
17413
|
return p1.then(function () {
|
|
17410
|
-
var p2 = addin.destroyed.call(
|
|
17414
|
+
var p2 = addin.destroyed.call(self);
|
|
17411
17415
|
if (!p2 instanceof Promise) {
|
|
17412
17416
|
p2 = Promise.resolve();
|
|
17413
17417
|
}
|