From 9422ecd2f80d231abba0381746721610470eca07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0tamcar?= Date: Fri, 27 Sep 2024 23:17:42 +0200 Subject: [PATCH] Fix extension translation system Despite that documentation says that locales should be formatted with underscore, formatting them with hyphen is also supported in Firefox. This commit removes the underscore conversion, as it makes it easier to manage translations through Crowdin. --- extension/src/utils/i18n.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/src/utils/i18n.js b/extension/src/utils/i18n.js index f5ab8ecf..948fb5b3 100644 --- a/extension/src/utils/i18n.js +++ b/extension/src/utils/i18n.js @@ -23,7 +23,7 @@ export async function getCurrentLocale () { * @returns {string[]} */ export function getAllLocales () { - return Object.keys(messages).map(code => code.replace('_', '-')) + return Object.keys(messages) } /** @@ -83,7 +83,7 @@ function parseICUPlural (message, count, locale) { * @returns {Promise} */ async function getMessageForLocale (key, substitutions, count, locale) { - const message = messages?.[locale.replace('-', '_')]?.[key] + const message = messages?.[locale]?.[key] if (!message) return let content = message.message