Skip to content

Commit

Permalink
Fix extension translation system
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
filips123 committed Sep 27, 2024
1 parent 51f360c commit 9422ecd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extension/src/utils/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/**
Expand Down Expand Up @@ -83,7 +83,7 @@ function parseICUPlural (message, count, locale) {
* @returns {Promise<string|undefined>}
*/
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
Expand Down

0 comments on commit 9422ecd

Please sign in to comment.