Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
blog-glebm-com/source/2014-02-27-i18n-made-easier-with-static-analysis.html.markdown.erb
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
62 lines (44 sloc)
2.6 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: Internationalization made easier with static analysis | |
date: "2014-02-27 09:41 CET" | |
tags: i18n, ruby | |
published: true | |
--- | |
[i18n-tasks][i18n-tasks] finds and manages missing and unused translations in your application. | |
The default approach to locale data management with gems such as [i18n][i18n-gem] is flawed. | |
If you use a key that does not exist, this will only blow up at runtime. Keys left over from removed code accumulate | |
in the resource files and introduce unnecessary overhead on the translators. Translation files can quickly turn to disarray. | |
i18n-tasks improves this by using static analysis. It scans calls such as `I18n.t('some.key')` and provides reports on key usage, missing, and unused keys. | |
It can also can pre-fill missing keys, including from Google Translate, and it can remove unused keys as well. | |
i18n-tasks can be used with any project using [i18n][i18n-gem] (default in Rails). | |
READMORE | |
It can make translation easier in many ways: | |
~~~ | |
$ i18n-tasks | |
Usage: i18n-tasks <command> [options] | |
-v, --version Print the version | |
-h, --help Display this help message. | |
Available commands: | |
missing show missing translations | |
unused show unused translations | |
translate-missing translate missing keys with Google Translate | |
add-missing add missing keys to the locales | |
find show where the keys are used in the code | |
normalize normalize translation data: sort and move to the right files | |
remove-unused remove unused keys | |
config display i18n-tasks configuration | |
xlsx-report save missing and unused translations to an Excel file | |
See `<command> --help` for more information on a specific command. | |
~~~ | |
There are lots of settings and you can use this on non-ruby codebases. | |
Reports come rendered in colourful full-resolution [terminal tables](https://github.com/visionmedia/terminal-table): | |
<a href="https://github.com/glebm/i18n-tasks" target="_blank"><img width="539" height="331" src="https://i.imgur.com/XZBd8l7.png" style="max-width:100%;"></a> | |
~~~ | |
$ i18n-tasks usages 'activities.*' | |
~~~ | |
<a href="https://github.com/glebm/i18n-tasks" target="_blank"><img width="655" height="193" src="https://i.imgur.com/VxBrSfY.png" alt="i18n-screenshot" title="i18n-tasks find output screenshot" style="max-width:100%;"></a> | |
### See also | |
* [i18n-tasks on GitHub](https://github.com/glebm/i18n-tasks). | |
* [HackerNews thread](https://news.ycombinator.com/item?id=7312390). | |
[i18n-tasks]: https://github.com/glebm/i18n-tasks "glebm/i18n-tasks on Github" | |
[i18n-gem]: https://github.com/svenfuchs/i18n "svenfuchs/i18n on Github" |