Skip to content

Locale Formats

Liam Hammett edited this page May 10, 2020 · 4 revisions

Supported Locale Formats

Format Read Write Annotations Note
JSON
YAML Comments will NOT be preserved*
JSON5 Comments will NOT be preserved*
INI Comments will NOT be preserved*
properties Comments will NOT be preserved*
POT
JavaScript Read-only
TypeScript Read-only
PHP Read-only

* 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 read-only mode by i18n-ally.readonly to prevent losing comments.

By default, formats support will be automatically enabled by the activated frameworks (e.g Laravel will enable php support).

To manually choose enabled formats:

// other formats will be disabled regardless of the framework preference.
"i18n-ally.enabledParsers": ["js", "ts", "pot"]

💡 From v2.0, formats other than JSON, YAML and JSON5 would be disabled by default.

Related Configures

// Sort keys alphabetically when saving
// Only works for json and yaml
"i18n-ally.sortKeys": false,

// Locale files indentation size
"i18n-ally.indent": 2,

// Locale files tab style
"i18n-ally.tabStyle": "space"

// File encoding for reading and writing locale files. 
// Set to "auto" to let it decide for you.
"i18n-ally.tabStyle": "utf-8"