Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed May 10, 2024
1 parent d4bc164 commit 84f6194
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 23.11.4

- perf(interpolator): use object deconstruction [2181](https://github.com/i18next/i18next/pull/2181)

## 23.11.3

- fix: Unsupported language is automatically added to preload option [2178](https://github.com/i18next/i18next/issues/2178)
Expand Down
46 changes: 32 additions & 14 deletions i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -1290,20 +1290,38 @@
if (!options.interpolation) options.interpolation = {
escapeValue: true
};
const iOpts = options.interpolation;
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
const {
escape: escape$1,
escapeValue,
useRawValueToEscape,
prefix,
prefixEscaped,
suffix,
suffixEscaped,
formatSeparator,
unescapeSuffix,
unescapePrefix,
nestingPrefix,
nestingPrefixEscaped,
nestingSuffix,
nestingSuffixEscaped,
nestingOptionsSeparator,
maxReplaces,
alwaysFormat
} = options.interpolation;
this.escape = escape$1 !== undefined ? escape$1 : escape;
this.escapeValue = escapeValue !== undefined ? escapeValue : true;
this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || '{{';
this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || '}}';
this.formatSeparator = formatSeparator || ',';
this.unescapePrefix = unescapeSuffix ? '' : unescapePrefix || '-';
this.unescapeSuffix = this.unescapePrefix ? '' : unescapeSuffix || '';
this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape('$t(');
this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(')');
this.nestingOptionsSeparator = nestingOptionsSeparator || ',';
this.maxReplaces = maxReplaces || 1000;
this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
this.resetRegExp();
}
reset() {
Expand Down
2 changes: 1 addition & 1 deletion i18next.min.js

Large diffs are not rendered by default.

0 comments on commit 84f6194

Please sign in to comment.