English | ็ฎไฝไธญๆ
Rails i18n is now supported! ๐
--------
Vue i18n Ally is now i18n Ally! Please check out Changes and Migration
Frameworks will be auto-detected when one of the dependencies can be found in the project.
Framework | Status | Trigger Packages |
---|---|---|
Vue | โ | vue-i18n , vuex-i18n , vue-i18next , nuxt-i18n |
Vue SFC i18n | โ | @kazupon/vue-i18n-loader |
React | โ | react-i18next , react-intl , next-i18next |
Angular(ngx-translate) | โ | @ngx-translate/core |
Flutter(flutter_i18n) | โ | flutter_i18n |
Ember.js | โ | ember-intl |
VSCode Extension | โ | @types/vscode , vscode |
i18next | โ | i18next |
i18nTag | โ | es2015-i18n-tag |
Joomla | โ | joomla/application |
Chrome Extension | โ | manual config by "i18n-ally.enabledFrameworks": "chrome-ext" |
Rails | โ | rails-i18n |
Angular(native) | Vote Here | |
๐ Custom | โ | For almost any frameworks! How to... |
If you would like to make it work for frameworks not listed above, you can:
- Open a Framework Support Request
- Fork and Raise a Pull Request
- Config your custom framework
- Multi-root workspace supported
- Remote development supported
- Supports numbers of popular frameworks
- Supports linked locale messages
- i18n for the extension itself, of course. Translation List
Format | Read | Write | Annonations | Note |
---|---|---|---|---|
JSON | โ | โ | โ | |
YAML | โ | โ | โ | Comments will NOT preserved* |
JSON5 | โ | โ | โ | Comments will NOT preserved* |
INI | โ | โ | โ | Comments will NOT preserved* |
JavaScript | โ | โ | โ | Forced in readonly mode |
TypeScript | โ | โ | โ | Forced in readonly mode |
* Due to the limitation of yaml.dumps
(#196) and JSON5.stringify
(#177), comments in YAML and JSON5 will be OMITTED on any modification by this extension (editing, translating, etc). If you are using comments in your locale files, you can turn on readonly mode by i18n-ally.readonly
to prevent lossing comments.
You can have locales directory 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
โโโ ...
โโโ <contry-code>.json
or
locales
โโโ en
| โโโ common.json
| โโโ buttons.json
| โโโ ...
| โโโ <filenames>.json
โโโ de-DE
| โโโ common.json
| โโโ buttons.json
| โโโ ...
โโโ <contry-code>
โโโ common.json
โโโ buttons.json
โโโ ...
All fields should add prefix "i18n-ally.
" in the setting.
Field | Default | Description |
---|---|---|
sourceLanguage |
en |
The primary locale for the project. It will also be the source language on translating |
displayLanguage |
en |
Displaying language in annotations and tree views |
localesPaths |
auto | Locales directory path, relative to root of the project. Can also be an array of paths. Glob patterns are acceptable |
sortedKeys |
false |
Sorting keys alphabetically on saving |
keystyle |
auto | Key style in your locale files, can be flat ({"a.b.c": "..."}) or nested ({"a": {"b": {"c": "..."}}}) |
readonly |
false |
Work on readonly mode. Translating and editing will be disabled |
annotations |
true |
Enabling inline annotations |
keepFulfilled |
false |
Always keep all keys fulfilled with empty string |
enabledFrameworks |
auto | You can specify what frameworks support you would like to enable. If no value is set, the extension will detect frameworks automatically |
indent |
2 | Indentation size for your locale files |
tabStyle |
space |
Tab style for your locale files |
promptTranslatingSource |
false |
Prompt to select source locale on translating every time. If set false, the source language in the config will be used |
Field | Default | Description |
---|---|---|
filenameMatchRegex |
null | Accept a regex allows you to map the filenames. The first group in regex should be the locale code |
To get best experience of this extension (and other translation services as well). We recommend you to use the following setup:
- Use
JSON
orYAML
as your locale files. (Although other formats are supported as well, JSON and YAML works best for statical analysis) - With following configurations allows you to keep synced through all the locales.
{
"i18n-ally.sortedKeys": true,
"i18n-ally.keepFulfilled": true,
}
This extension itself supports i18n as well, it will be auto matched to the display language you used in your vscode editor. We have supported following languages.
Language | Maintainer | Contributors |
---|---|---|
English | @antfu | @rubjo |
Simplified Chinese (็ฎไฝไธญๆ) | @antfu | |
Traditional Chinese (็น้ซไธญๆ) | @antfu | |
Norwegian (Norsk) | @rubjo | |
Spanish (Espaรฑol) | @Baltimer | |
Japanese (ๆฅๆฌ่ช) | @isdh | |
Dutch (Nederlands) | @Niekvdm | |
Portuguese (Brazilian) | @Ibcs16 | |
Franรงais | @Nicoxx45 |
If you would like to help translate this extension, you can do it by following steps.
- Fork this repo and clone it to you local machine
- Copy
package.nls.json
topackage.nls.<locale-code>.json
in the root of the repo - Translate every single message in the new json file you created.
- You may also update the table above in README.md
- Commit changes and make a PR to this repo
We recommend you to use vscode with i18n-ally
. It supports i18n for vscode extension development which can help you translate itself ๐.
This extension support numerous of frameworks, be sure the framework you are using is in the list.
Besides, package.json
is relied on detecting 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 at the first time you open a project. If the nothing show 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. - Goto 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.
In some cases, you may use modules, monorepo or other philosophies to organize your locale files.
For example, you have 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
| โโโ ...
โโโ ...
You could change your config like this:
{
"i18n-ally.localesPaths": [
"packages/**/**/i18n"
],
"i18n-ally.filenameMatchRegex": "^([\\w-]*)\\.messages\\.json",
}
This extension was inspired by think2011/vscode-vue-i18n, it can't be existed without @think2011's great work.
Support for Vue Single File Component (SFC) is powered by kazupon/vue-i18n-locale-message, which is created by the author of vue-i18n. Thanks for making this!
Also my great thanks to all the awesome contributors and YOU for reading this!
Lastly, I want to have a special thanks to my partner @iiiiiiines who have encouraged and supported me working on this project.
I made this project with heart โค
If you found it useful, you may consider buy me a coffee!
MIT License ยฉ 2019-2020 Anthony Fu