@fkui/i18next-translate 6.36.1 → 6.37.0
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/dist/cjs/index.js +13 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +13 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -3275,13 +3275,13 @@ class Interpolator {
|
|
|
3275
3275
|
const handleHasOptions = (key, inheritedOptions) => {
|
|
3276
3276
|
const sep = this.nestingOptionsSeparator;
|
|
3277
3277
|
if (key.indexOf(sep) < 0) return key;
|
|
3278
|
-
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
3278
|
+
const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
|
|
3279
3279
|
let optionsString = `{${c[1]}`;
|
|
3280
3280
|
key = c[0];
|
|
3281
3281
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
3282
3282
|
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
3283
3283
|
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
3284
|
-
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes
|
|
3284
|
+
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
|
|
3285
3285
|
optionsString = optionsString.replace(/'/g, '"');
|
|
3286
3286
|
}
|
|
3287
3287
|
try {
|
|
@@ -3763,13 +3763,21 @@ const bindMemberFunctions = inst => {
|
|
|
3763
3763
|
}
|
|
3764
3764
|
});
|
|
3765
3765
|
};
|
|
3766
|
-
|
|
3766
|
+
const SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
|
|
3767
|
+
const getSupportNoticeShown = () => typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY];
|
|
3768
|
+
const setSupportNoticeShown = () => {
|
|
3769
|
+
if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
3770
|
+
};
|
|
3767
3771
|
const usesLocize = inst => {
|
|
3768
3772
|
if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
|
|
3769
3773
|
if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
|
|
3770
3774
|
if (inst?.options?.backend?.backends) {
|
|
3771
3775
|
if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
|
|
3772
3776
|
}
|
|
3777
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
3778
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
3779
|
+
if (inst.options.backend.backendOptions.some(b => b?.projectId)) return true;
|
|
3780
|
+
}
|
|
3773
3781
|
return false;
|
|
3774
3782
|
};
|
|
3775
3783
|
class I18n extends EventEmitter {
|
|
@@ -3824,9 +3832,9 @@ class I18n extends EventEmitter {
|
|
|
3824
3832
|
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
3825
3833
|
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
3826
3834
|
}
|
|
3827
|
-
if (this.options.showSupportNotice !== false && !usesLocize(this) && !
|
|
3835
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
3828
3836
|
if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
|
|
3829
|
-
|
|
3837
|
+
setSupportNoticeShown();
|
|
3830
3838
|
}
|
|
3831
3839
|
const createClassOnDemand = ClassOrObject => {
|
|
3832
3840
|
if (!ClassOrObject) return null;
|