@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/cjs/index.js
CHANGED
|
@@ -3096,7 +3096,7 @@ class PluralResolver {
|
|
|
3096
3096
|
type
|
|
3097
3097
|
});
|
|
3098
3098
|
} catch (err) {
|
|
3099
|
-
if (
|
|
3099
|
+
if (typeof Intl === 'undefined') {
|
|
3100
3100
|
this.logger.error('No Intl support, please use an Intl polyfill!');
|
|
3101
3101
|
return dummyRule;
|
|
3102
3102
|
}
|
|
@@ -3277,13 +3277,13 @@ class Interpolator {
|
|
|
3277
3277
|
const handleHasOptions = (key, inheritedOptions) => {
|
|
3278
3278
|
const sep = this.nestingOptionsSeparator;
|
|
3279
3279
|
if (key.indexOf(sep) < 0) return key;
|
|
3280
|
-
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
3280
|
+
const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
|
|
3281
3281
|
let optionsString = `{${c[1]}`;
|
|
3282
3282
|
key = c[0];
|
|
3283
3283
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
3284
3284
|
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
3285
3285
|
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
3286
|
-
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes
|
|
3286
|
+
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
|
|
3287
3287
|
optionsString = optionsString.replace(/'/g, '"');
|
|
3288
3288
|
}
|
|
3289
3289
|
try {
|
|
@@ -3765,12 +3765,21 @@ const bindMemberFunctions = inst => {
|
|
|
3765
3765
|
}
|
|
3766
3766
|
});
|
|
3767
3767
|
};
|
|
3768
|
+
const SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
|
|
3769
|
+
const getSupportNoticeShown = () => typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY];
|
|
3770
|
+
const setSupportNoticeShown = () => {
|
|
3771
|
+
if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
3772
|
+
};
|
|
3768
3773
|
const usesLocize = inst => {
|
|
3769
3774
|
if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
|
|
3770
3775
|
if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
|
|
3771
3776
|
if (inst?.options?.backend?.backends) {
|
|
3772
3777
|
if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
|
|
3773
3778
|
}
|
|
3779
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
3780
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
3781
|
+
if (inst.options.backend.backendOptions.some(b => b?.projectId)) return true;
|
|
3782
|
+
}
|
|
3774
3783
|
return false;
|
|
3775
3784
|
};
|
|
3776
3785
|
class I18n extends EventEmitter {
|
|
@@ -3825,8 +3834,9 @@ class I18n extends EventEmitter {
|
|
|
3825
3834
|
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
3826
3835
|
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
3827
3836
|
}
|
|
3828
|
-
if (this.options.showSupportNotice !== false && !usesLocize(this)) {
|
|
3829
|
-
if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is maintained with support from
|
|
3837
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
3838
|
+
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 💙');
|
|
3839
|
+
setSupportNoticeShown();
|
|
3830
3840
|
}
|
|
3831
3841
|
const createClassOnDemand = ClassOrObject => {
|
|
3832
3842
|
if (!ClassOrObject) return null;
|