From 1f0ea59051530964548616b300719e550b646cff Mon Sep 17 00:00:00 2001 From: Bozana Bokan Date: Tue, 29 Oct 2024 13:22:28 +0100 Subject: [PATCH] use weblate locales for ui --- src/mixins/localizeMoment.js | 8 ++++---- src/pages/dashboard/mocks/pageInitConfig.js | 22 --------------------- src/utils/i18n.js | 8 ++++---- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/mixins/localizeMoment.js b/src/mixins/localizeMoment.js index 97503cb48..acc620104 100644 --- a/src/mixins/localizeMoment.js +++ b/src/mixins/localizeMoment.js @@ -11,13 +11,13 @@ export default { * This only maps the locales that need to be translated. * Most PKP locales work fine in Moment.js. * - * @param {String} locale The PKP locale, eg - `sr_RS@cyrillic` + * @param {String} locale The PKP locale, eg - `sr_Cyrl` */ getMomentLocale(locale) { const map = { - 'sr_RS@latin': 'sr', - 'sr_RS@cyrillic': 'sr-cyrl', - 'uz_UZ@latin': 'uz-latn', + sr_Latn: 'sr', + sr_Cyrl: 'sr-cyrl', + uz_Latn: 'uz-latn', }; return map[locale] ?? locale; diff --git a/src/pages/dashboard/mocks/pageInitConfig.js b/src/pages/dashboard/mocks/pageInitConfig.js index 2593cbd21..8b5d07c59 100644 --- a/src/pages/dashboard/mocks/pageInitConfig.js +++ b/src/pages/dashboard/mocks/pageInitConfig.js @@ -427,17 +427,6 @@ export default { _extractionAdaptersLoaded: false, _metadataInjectionAdapters: [], _injectionAdaptersLoaded: false, - _localesTable: { - 'be@cyrillic': 'be', - bs: 'bs_Latn', - fr_FR: 'fr', - nb: 'nb_NO', - 'sr@cyrillic': 'sr_Cyrl', - 'sr@latin': 'sr_Latn', - 'uz@cyrillic': 'uz', - 'uz@latin': 'uz_Latn', - zh_CN: 'zh_Hans', - }, }, 2: { _data: { @@ -475,17 +464,6 @@ export default { _extractionAdaptersLoaded: false, _metadataInjectionAdapters: [], _injectionAdaptersLoaded: false, - _localesTable: { - 'be@cyrillic': 'be', - bs: 'bs_Latn', - fr_FR: 'fr', - nb: 'nb_NO', - 'sr@cyrillic': 'sr_Cyrl', - 'sr@latin': 'sr_Latn', - 'uz@cyrillic': 'uz', - 'uz@latin': 'uz_Latn', - zh_CN: 'zh_Hans', - }, }, }, publicationTitleAbstractForm: { diff --git a/src/utils/i18n.js b/src/utils/i18n.js index ea8587667..17618d94d 100644 --- a/src/utils/i18n.js +++ b/src/utils/i18n.js @@ -170,13 +170,13 @@ export function localizeSubmission(localizedString, submissionLocale) { * This only maps the locales that need to be translated. * Most PKP locales work fine in Moment.js. * - * @param {String} locale The PKP locale, eg - `sr_RS@cyrillic` + * @param {String} locale The PKP locale, eg - `sr_Cyrl` */ export function getMomentLocale(locale) { const map = { - 'sr_RS@latin': 'sr', - 'sr_RS@cyrillic': 'sr-cyrl', - 'uz_UZ@latin': 'uz-latn', + sr_Latn: 'sr', + sr_Cyrl: 'sr-cyrl', + uz_Latn: 'uz-latn', }; return map[locale] ?? locale;