-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path2014-02-27-i18n-made-easier-with-static-analysis.html.markdown.erb
62 lines (44 loc) · 2.6 KB
/
2014-02-27-i18n-made-easier-with-static-analysis.html.markdown.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
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"