-
Notifications
You must be signed in to change notification settings - Fork 309
FAQ
Your locales directory can be structured like this with zero-configuration
locales # i18n, langs, locale are also acceptable
βββ en.json
βββ de-DE.json
βββ zh-CN.yml # YAML
βββ zh-TW.ts # You can mix different formats
βββ ...
βββ <country-code>.json
or
locales
βββ en
| βββ common.json
| βββ buttons.json
| βββ ...
| βββ <filenames>.json
βββ de-DE
| βββ common.json
| βββ buttons.json
| βββ ...
βββ <country-code>
βββ common.json
βββ buttons.json
βββ ...
For more complex structure, please check out Path Matcher.
To get the best experience from this extension (and other translation services as well), We recommend you use the following setup:
- Use
JSON
orYAML
as your locale files. (Although other formats are supported as well, JSON and YAML works best for statistical analysis) - The following configuration allows you to stay synced through all the locales.
{
"i18n-ally.sortKeys": true,
"i18n-ally.keepFulfilled": true,
}
This extension support numerous frameworks. Be sure the framework you are using is on the list.
Also, package.json
is relied on to detect which framework you are using. It should be at the root of your project as well.
-
Locales path config missing.
locales
path will be detected automatically the first time you open a project. If nothing shows up, you may need to configure it manually. There are two ways to do that:- Open Command Palette (
Ctrl-Shift-P
orββ§P
), typei18n Ally: Manual configure locales path
then press enter and follow the guide. - Go to the settings of VSCode and set
i18n-ally.localesPaths
manually.
- Open Command Palette (
-
The source / displaying locale. The default locale is set to English(
en
). If you don't have English in your supporting locales, you may need to config it through commandi18n Ally: Change source language
- Check your Directory structure
Usually, i18n ally
looks for your package.json
file at the root of your project. If you don't have it at the root, you can always specify the framework(s) you are using by i18n-ally.enabledFrameworks
config.
Due to the discussion in #313, flags should not be used to represent languages. From v2.2.4, we changed the algorithm of match flags, language codes (the first two-letter locales in BCP-47) will no longer be used as a factor to match flags.
We would suggest you use a more specific en-US
form instead of the en
for example. But if you would like to set flags for two-letter locales anyway, you can use the config:
"i18n-ally.localeCountryMap": {
"en": "br", // show UK's flag instead of US's
"zh": "cn", // show Chinese flag for 'zh'
"ko": "ko", // show Korean flag for 'ko'
}
In some cases, you may use modules, monorepo or other philosophies to organize your locale files.
For example, you have the following directory structure need to be config.
packages
βββ pkgA
| βββ i18n
| βββ en.messages.json
| βββ zh-CN.messages.json
| βββ ...
βββ pkgB
| βββ i18n
| βββ en.messages.json
| βββ zh-CN.messages.json
| βββ ...
βββ ...
The following config would make it work,
{
"i18n-ally.localesPaths": [
"packages/**/**/i18n"
],
"i18n-ally.pathMatcher": "{locale}.messages.json",
}
Learn more about
pathMatcher
Lokalise is the fastest growing language cloud technology made by developers, for developers.
As a collaborative productivity platform, it helps structure and automate the translation and localization process for any company in the world.
Learn more
πβπ¨ Review & Collaborate
πͺ¨ Hard-coded Strings Extraction
βοΈ Configurations
π Migration