@fkui/i18next-translate 6.13.0 → 6.15.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 +16 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +16 -3
- 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
|
@@ -1748,9 +1748,13 @@ class I18n extends EventEmitter {
|
|
|
1748
1748
|
prepend: this.options.pluralSeparator,
|
|
1749
1749
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1750
1750
|
});
|
|
1751
|
+
const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
|
|
1752
|
+
if (usingLegacyFormatFunction) {
|
|
1753
|
+
this.logger.warn(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
|
|
1754
|
+
}
|
|
1751
1755
|
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
1752
1756
|
s.formatter = createClassOnDemand(formatter);
|
|
1753
|
-
s.formatter.init(s, this.options);
|
|
1757
|
+
if (s.formatter.init) s.formatter.init(s, this.options);
|
|
1754
1758
|
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
1755
1759
|
}
|
|
1756
1760
|
s.interpolator = new Interpolator(this.options);
|
|
@@ -2065,13 +2069,13 @@ class I18n extends EventEmitter {
|
|
|
2065
2069
|
dir(lng) {
|
|
2066
2070
|
if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
|
|
2067
2071
|
if (!lng) return 'rtl';
|
|
2068
|
-
|
|
2072
|
+
try {
|
|
2069
2073
|
const l = new Intl.Locale(lng);
|
|
2070
2074
|
if (l && l.getTextInfo) {
|
|
2071
2075
|
const ti = l.getTextInfo();
|
|
2072
2076
|
if (ti && ti.direction) return ti.direction;
|
|
2073
2077
|
}
|
|
2074
|
-
}
|
|
2078
|
+
} catch (e) {}
|
|
2075
2079
|
const rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
|
|
2076
2080
|
const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
|
|
2077
2081
|
if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
|
|
@@ -2160,7 +2164,16 @@ instance.loadNamespaces;
|
|
|
2160
2164
|
instance.loadLanguages;
|
|
2161
2165
|
|
|
2162
2166
|
/**
|
|
2167
|
+
* Determine if a value is empty.
|
|
2168
|
+
*
|
|
2169
|
+
* A value is considered empty if it is:
|
|
2170
|
+
*
|
|
2171
|
+
* - `undefined`
|
|
2172
|
+
* - `null`
|
|
2173
|
+
* - empty string `""`.
|
|
2174
|
+
*
|
|
2163
2175
|
* @public
|
|
2176
|
+
* @param value - value to check if it is empty
|
|
2164
2177
|
*/
|
|
2165
2178
|
|
|
2166
2179
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|