@sumaris-net/ngx-components 2.5.16-rc1 → 2.5.16-rc3
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/esm2020/src/app/core/services/platform.service.mjs +22 -17
- package/fesm2015/sumaris-net.ngx-components.mjs +21 -16
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +21 -16
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/platform.service.d.ts +1 -0
|
@@ -18757,25 +18757,12 @@ class PlatformService extends StartableService {
|
|
|
18757
18757
|
console.info('[platform] Configuring i18n ...');
|
|
18758
18758
|
// this language will be used as a fallback when a translation isn't found in the current language
|
|
18759
18759
|
this.translate.setDefaultLang(this.environment.defaultLocale);
|
|
18760
|
+
// apply locale immediately
|
|
18761
|
+
this.applyLocale(this.environment.defaultLocale);
|
|
18760
18762
|
// When locale changes, apply to date adapter
|
|
18761
18763
|
this.registerSubscription(this.translate.onLangChange.subscribe(event => {
|
|
18762
18764
|
if (event && event.lang) {
|
|
18763
|
-
|
|
18764
|
-
if (event.lang === 'en') {
|
|
18765
|
-
event.lang = 'en_GB';
|
|
18766
|
-
}
|
|
18767
|
-
// config moment lib
|
|
18768
|
-
try {
|
|
18769
|
-
locale(event.lang);
|
|
18770
|
-
console.debug('[platform] Use locale {' + event.lang + '}');
|
|
18771
|
-
}
|
|
18772
|
-
// If error, fallback to en
|
|
18773
|
-
catch (err) {
|
|
18774
|
-
locale('en');
|
|
18775
|
-
console.warn('[platform] Unknown locale for moment lib. Using default [en]');
|
|
18776
|
-
}
|
|
18777
|
-
// Config date adapter
|
|
18778
|
-
this.dateAdapter.setLocale(locale());
|
|
18765
|
+
this.applyLocale(event.lang);
|
|
18779
18766
|
}
|
|
18780
18767
|
}));
|
|
18781
18768
|
this.registerSubscription(this.settings.onChange.subscribe(data => {
|
|
@@ -18800,6 +18787,24 @@ class PlatformService extends StartableService {
|
|
|
18800
18787
|
}
|
|
18801
18788
|
}));
|
|
18802
18789
|
}
|
|
18790
|
+
applyLocale(locale$1) {
|
|
18791
|
+
// force 'en' as 'en_GB'
|
|
18792
|
+
if (locale$1 === 'en') {
|
|
18793
|
+
locale$1 = 'en_GB';
|
|
18794
|
+
}
|
|
18795
|
+
// config moment lib
|
|
18796
|
+
try {
|
|
18797
|
+
locale(locale$1);
|
|
18798
|
+
console.debug('[platform] Use locale {' + locale$1 + '}');
|
|
18799
|
+
}
|
|
18800
|
+
// If error, fallback to en
|
|
18801
|
+
catch (err) {
|
|
18802
|
+
locale('en');
|
|
18803
|
+
console.warn('[platform] Unknown locale for moment lib. Using default [en]');
|
|
18804
|
+
}
|
|
18805
|
+
// Config date adapter
|
|
18806
|
+
this.dateAdapter.setLocale(locale());
|
|
18807
|
+
}
|
|
18803
18808
|
configureCache(online) {
|
|
18804
18809
|
online = toBoolean(online, this.cache.isOnline());
|
|
18805
18810
|
const cacheTTL = online ? 3600 /* 1h */ : 3600 * 24 * 30; /* 1 month */
|