Add language
The language files are located in the popup/localization
folder. Here the locales
contains the language key pair json files and the i18n.ts
file contains the relevant settings that's used for the popup.
To add a new language at first create a new file. Like lets say if we want to add french, we will create a fr.json
file in the popup/localization/locales
folder.
After that we'll go into the i18n.ts
file. We'll import the fr.json
into the ts file renamed as frJson
and add an entry to the translations
object.
The changed code should look something like this.
import frJson from "./locales/fr.json";
const translations = {
en: { translation: { ...enJSON } },
de: { translation: { ...deJson } },
fr: { translation: { ...frJson } },
};
We would also recommend the i18n Ally
extension in vscode to make working with translations easier.