@fkui/i18next-translate 6.36.1 → 6.38.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 CHANGED
@@ -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.length % 2 !== 0) {
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,13 +3765,21 @@ const bindMemberFunctions = inst => {
3765
3765
  }
3766
3766
  });
3767
3767
  };
3768
- let supportNoticeShown = false;
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
+ };
3769
3773
  const usesLocize = inst => {
3770
3774
  if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
3771
3775
  if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
3772
3776
  if (inst?.options?.backend?.backends) {
3773
3777
  if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
3774
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
+ }
3775
3783
  return false;
3776
3784
  };
3777
3785
  class I18n extends EventEmitter {
@@ -3826,9 +3834,9 @@ class I18n extends EventEmitter {
3826
3834
  if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
3827
3835
  this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
3828
3836
  }
3829
- if (this.options.showSupportNotice !== false && !usesLocize(this) && !supportNoticeShown) {
3837
+ if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
3830
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 💙');
3831
- supportNoticeShown = true;
3839
+ setSupportNoticeShown();
3832
3840
  }
3833
3841
  const createClassOnDemand = ClassOrObject => {
3834
3842
  if (!ClassOrObject) return null;