Skip to content

getTranslation() in i18n.js doesn't check language #1

Description

@mestrini

When copying the links, the success message text is fetched from the translations constant without checking first if browser's language isn't Japanese. To fix that I copied the language verification from applyTranslations() and applied it to the return line in getTranslation().

function getTranslation(key) {
const userLanguage = navigator.language || navigator.userLanguage;
const isJapanese = userLanguage.startsWith('ja');
return isJapanese && translations[key.toLowerCase()] || key;
}

Tx for sharing the project

PS: I forked this project and have implemented localization :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions