@tolgee/format-icu 5.29.6-prerelease.4e3062df.0 → 5.29.6-prerelease.fc7efe8f.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/tolgee-format-icu.cjs.js +3 -3
- package/dist/tolgee-format-icu.cjs.js.map +1 -1
- package/dist/tolgee-format-icu.cjs.min.js +1 -1
- package/dist/tolgee-format-icu.cjs.min.js.map +1 -1
- package/dist/tolgee-format-icu.esm.js +3 -3
- package/dist/tolgee-format-icu.esm.js.map +1 -1
- package/dist/tolgee-format-icu.esm.min.js +1 -1
- package/dist/tolgee-format-icu.esm.min.js.map +1 -1
- package/dist/tolgee-format-icu.esm.min.mjs +1 -1
- package/dist/tolgee-format-icu.esm.min.mjs.map +1 -1
- package/dist/tolgee-format-icu.esm.mjs +3 -3
- package/dist/tolgee-format-icu.esm.mjs.map +1 -1
- package/dist/tolgee-format-icu.umd.js +3 -3
- package/dist/tolgee-format-icu.umd.js.map +1 -1
- package/dist/tolgee-format-icu.umd.min.js +1 -1
- package/dist/tolgee-format-icu.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/createFormatIcu.test.ts +4 -4
- package/src/createFormatIcu.ts +3 -3
|
@@ -3894,7 +3894,7 @@ const createFormatIcu = () => {
|
|
|
3894
3894
|
return false;
|
|
3895
3895
|
}
|
|
3896
3896
|
}
|
|
3897
|
-
function
|
|
3897
|
+
function getLanguage(language) {
|
|
3898
3898
|
if (!locales.get(language)) {
|
|
3899
3899
|
let localeCandidate = String(language).replace(/[^a-zA-Z]/g, '-');
|
|
3900
3900
|
while (!isLocaleValid(localeCandidate)) {
|
|
@@ -3907,12 +3907,12 @@ const createFormatIcu = () => {
|
|
|
3907
3907
|
}
|
|
3908
3908
|
const format = ({ translation, language, params, }) => {
|
|
3909
3909
|
const ignoreTag = !Object.values(params || {}).find((p) => typeof p === 'function');
|
|
3910
|
-
const locale =
|
|
3910
|
+
const locale = getLanguage(language);
|
|
3911
3911
|
return new IntlMessageFormat(translation, locale, undefined, {
|
|
3912
3912
|
ignoreTag,
|
|
3913
3913
|
}).format(params);
|
|
3914
3914
|
};
|
|
3915
|
-
return Object.freeze({
|
|
3915
|
+
return Object.freeze({ getLanguage, format });
|
|
3916
3916
|
};
|
|
3917
3917
|
|
|
3918
3918
|
const FormatIcu = () => (tolgee, tools) => {
|