@fkui/i18next-translate 6.36.0 → 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 +15 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +15 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/types/tsdoc-metadata.json +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -3094,7 +3094,7 @@ class PluralResolver {
|
|
|
3094
3094
|
type
|
|
3095
3095
|
});
|
|
3096
3096
|
} catch (err) {
|
|
3097
|
-
if (
|
|
3097
|
+
if (typeof Intl === 'undefined') {
|
|
3098
3098
|
this.logger.error('No Intl support, please use an Intl polyfill!');
|
|
3099
3099
|
return dummyRule;
|
|
3100
3100
|
}
|
|
@@ -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,12 +3763,21 @@ const bindMemberFunctions = inst => {
|
|
|
3763
3763
|
}
|
|
3764
3764
|
});
|
|
3765
3765
|
};
|
|
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
|
+
};
|
|
3766
3771
|
const usesLocize = inst => {
|
|
3767
3772
|
if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
|
|
3768
3773
|
if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
|
|
3769
3774
|
if (inst?.options?.backend?.backends) {
|
|
3770
3775
|
if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
|
|
3771
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
|
+
}
|
|
3772
3781
|
return false;
|
|
3773
3782
|
};
|
|
3774
3783
|
class I18n extends EventEmitter {
|
|
@@ -3823,8 +3832,9 @@ class I18n extends EventEmitter {
|
|
|
3823
3832
|
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
3824
3833
|
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
3825
3834
|
}
|
|
3826
|
-
if (this.options.showSupportNotice !== false && !usesLocize(this)) {
|
|
3827
|
-
if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is maintained with support from
|
|
3835
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
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 💙');
|
|
3837
|
+
setSupportNoticeShown();
|
|
3828
3838
|
}
|
|
3829
3839
|
const createClassOnDemand = ClassOrObject => {
|
|
3830
3840
|
if (!ClassOrObject) return null;
|