chrome-i18n is a command line tool for your Chrome/Chromium apps and extensions. It aims to help you in easily build a complete database of locales starting from some project files.
$ npm install -g chrome-i18n
To show the help, just type
$ chrome-i18n --help
$ man chrome-i18n
To build a project
$ chrome-i18n [-f|--file <your-dictionary-json>]
--file option is omitted, the default project file will be set to
./dictionary.json. The only supported file format is JSON. Not
well-formed JSON files will be ignored.
Currently are supported three different ways in defining a project:
|monolith||the project file is a unique JSON file. It contains both the
|category||the project is divided into a meta descriptor file describing the project structure, and one or more definition files. Further informations in
|language||the project is divided into a meta descriptor file describing the project structure and database definitions, and as many files as the supported languages. Further informations in
In this example we want to build a database from an unique file (the
mode). To achieve this, we create a project file:
"meta":"format": "monolith""dest": "./_locales/""locales": "it" "en""database":"helloWorld":"description": "a greetings message""locales":"it": "Salve Mondo!""en": "Hello World!"
and save giving name dictionary.json, then run our CLI tool:
The program will looks for a file named dictionary.json into the current directory, and builds the classic _locales directory structure for all the languages defined in our project file.
Internationalization files in Chrome/Chromium are JSON files composed by an object with tenths or hundreds (sometimes thousands) keys which describe how a string has to be translated in a particular language.
People usually code these gigantic files by hand, one for each language they want to give support. Each language with its own directory and definition file. Same structure, same keys, same rules, but the translated message.
It's a lot of useless redundancy to manage by hand. This sucks and the goal is to make it easier to manage.
chrome-i18n is a specific tool which will build a complete database for your Chrome extensions and web apps starting from some project files, easier to maintain and manage.
Any contribution to improve the project and/or expand it is welcome.
If you're interested in contributing to this project, take care to maintain the existing coding style.
The project follows these standard, so please you do it too:
git checkout -b my-new-feature)
git commit -am 'Add some feature')
git push origin my-new-feature)
Add unit tests for any new or changed functionality. Lint and test your code using grunt.
See the CHANGELOG file distributed with the project.
Copyright (c) 2012-2013 Marco Trulla - Licensed under the MIT license.
See the LICENSE file distributed with the project.