@fkui/i18next-translate 6.15.0 → 6.16.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/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 Försäkringskassan
1
+ Copyright 2025 Försäkringskassan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/dist/cjs/index.js CHANGED
@@ -771,22 +771,22 @@ class Translator extends EventEmitter {
771
771
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
772
772
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
773
773
  if (needsPluralHandling) {
774
- finalKeys.push(key + pluralSuffix);
775
774
  if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
776
775
  finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
777
776
  }
777
+ finalKeys.push(key + pluralSuffix);
778
778
  if (needsZeroSuffixLookup) {
779
779
  finalKeys.push(key + zeroSuffix);
780
780
  }
781
781
  }
782
782
  if (needsContextHandling) {
783
- const contextKey = `${key}${this.options.contextSeparator}${opt.context}`;
783
+ const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`;
784
784
  finalKeys.push(contextKey);
785
785
  if (needsPluralHandling) {
786
- finalKeys.push(contextKey + pluralSuffix);
787
786
  if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
788
787
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
789
788
  }
789
+ finalKeys.push(contextKey + pluralSuffix);
790
790
  if (needsZeroSuffixLookup) {
791
791
  finalKeys.push(contextKey + zeroSuffix);
792
792
  }
@@ -1105,7 +1105,7 @@ class Interpolator {
1105
1105
  };
1106
1106
  this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
1107
1107
  this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
1108
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
1108
+ this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
1109
1109
  }
1110
1110
  interpolate(str, data, lng, options) {
1111
1111
  let match;