pome-ui 2.0.0-preview11 → 2.0.0-preview13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pome-ui",
3
- "version": "2.0.0-preview11",
3
+ "version": "2.0.0-preview13",
4
4
  "description": "Front-end MVC library",
5
5
  "main": "pome-ui.js",
6
6
  "bin": {
@@ -71,11 +71,13 @@ function create() {
71
71
 
72
72
  var key = arguments[0];
73
73
  var val = key;
74
- if (this.overrides[this.getCurrentLocale()]) {
75
- val = this.overrides[this.getCurrentLocale()][key]
74
+ var foundInOverrides = false;
75
+ if (this.overrides[this.getCurrentLocale()] && this.overrides[this.getCurrentLocale()][key]) {
76
+ val = this.overrides[this.getCurrentLocale()][key];
77
+ foundInOverrides = true;
76
78
  }
77
79
 
78
- if (!val && this.texts[key]) {
80
+ if (!foundInOverrides && this.texts[key]) {
79
81
  val = this.texts[key];
80
82
  }
81
83
 
@@ -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(!t&&this.texts[e]){t=this.texts[e]}for(var l=1;l<arguments.length;++l){t=t.replaceAll(`{${l-1}}`,arguments[l])}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;
1
+ function create(){var a=null;return{locales:{},texts:{},overrides:{},getCurrentLocale(){return a},addLocale(e,t,r){if(!t){var l=e.lastIndexOf("/");if(l<0){t=e}else{t=e.substr(e,l+1)}t=t.split(".")[0]}if(typeof t=="string"){this.locales[t]=e}else if(t instanceof Array){for(var a=0;a<t.length;++a){this.locales[t[a]]=e}}if(r){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"}a=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 r=Object.getOwnPropertyNames(t);var l=this;r.forEach(function(e){if(!l.texts[e]){l.texts[e]=t[e]}})}}},sr(){if(arguments.length==0){return null}var e=arguments[0];var t=e;var r=false;if(this.overrides[this.getCurrentLocale()]&&this.overrides[this.getCurrentLocale()][e]){t=this.overrides[this.getCurrentLocale()][e];r=true}if(!r&&this.texts[e]){t=this.texts[e]}for(var l=1;l<arguments.length;++l){t=t.replaceAll(`{${l-1}}`,arguments[l])}return t},setLocalizedString(e,t,r){var l=this;e.forEach(function(e){if(!l.overrides[e]){l.overrides[e]={}}l.overrides[e][t]=r})}}}exports.create=create;