concrete5/concrete5 — pull request #1410 by mlocati (2013-10-03 13:10:47+00:00)
Title: Add the 'translations' task to Grunt

Running 'grunt translations' does the following:
- fetches the available languages from Transifex
- skips the languages with a translation progress below 95%
- downloads .po files
- compile .mo files from .po files with gettext's msgfmt (that must be available in PATH)
- deletes the downloaded .po files

You have to create a Gruntfile.c5config.js file.
See Gruntfile.c5config-sample.js for further instructions.

Here's the output of `grunt translations`:
```
Running "translations" task
Retrieving available locales for Transifex resource core-5621... 46 locales found.
Locale ar [Arabic]... progress: 58% -> skipped
Locale bs_BA [Bosnian (Bosnia and Herzegovina)]... progress: 36% -> skipped
Locale bg_BG [Bulgarian (Bulgaria)]... progress: 49% -> skipped
Locale my_MM [Burmese (Myanmar)]... progress: 15% -> skipped
Locale ca [Catalan]... progress: 32% -> skipped
Locale zh_CN [Chinese (China)]... progress: 97% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale zh_TW [Chinese (Taiwan)]... progress: 23% -> skipped
Locale hr_HR [Croatian (Croatia)]... progress: 36% -> skipped
Locale cs_CZ [Czech (Czech Republic)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale da_DK [Danish (Denmark)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale nl_NL [Dutch (Netherlands)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale et_EE [Estonian (Estonia)]... progress: 46% -> skipped
Locale fi_FI [Finnish (Finland)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale fr_FR [French (France)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale de_DE [German (Germany)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale el_GR [Greek (Greece)]... progress: 91% -> skipped
Locale he_IL [Hebrew (Israel)]... progress: 93% -> skipped
Locale hi_IN [Hindi (India)]... progress: 1% -> skipped
Locale hu_HU [Hungarian (Hungary)]... progress: 80% -> skipped
Locale id_ID [Indonesian (Indonesia)]... progress: 54% -> skipped
Locale it_IT [Italian (Italy)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale ja_JP [Japanese (Japan)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale km_KH [Khmer (Cambodia)]... progress: 0% -> skipped
Locale ko_KR [Korean (Korea)]... progress: 14% -> skipped
Locale ku [Kurdish]... progress: 0% -> skipped
Locale lt_LT [Lithuanian (Lithuania)]... progress: 6% -> skipped
Locale mk_MK [Macedonian (Macedonia)]... progress: 53% -> skipped
Locale nb_NO [Norwegian Bokmål (Norway)]... progress: 20% -> skipped
Locale fa_IR [Persian (Iran)]... progress: 98% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale pl_PL [Polish (Poland)]... progress: 93% -> skipped
Locale pt_BR [Portuguese (Brazil)]... progress: 75% -> skipped
Locale pt_PT [Portuguese (Portugal)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale ro_RO [Romanian (Romania)]... progress: 97% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale ru_RU [Russian (Russia)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale sk_SK [Slovak (Slovakia)]... progress: 51% -> skipped
Locale sl_SI [Slovenian (Slovenia)]... progress: 1% -> skipped
Locale es_AR [Spanish (Argentina)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale es_MX [Spanish (Mexico)]... progress: 1% -> skipped
Locale es_PE [Spanish (Peru)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale es_ES [Spanish (Spain)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale sv_SE [Swedish (Sweden)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale ta_IN [Tamil (India)]... progress: 0% -> skipped
Locale th_TH [Thai (Thailand)]... progress: 60% -> skipped
Locale tr_TR [Turkish (Turkey)]... progress: 100% -> ok
downloading .po file... done.
compiling .mo file... done.
deleting .po file... done.
Locale uk_UA [Ukrainian (Ukraine)]... progress: 34% -> skipped
Locale vi_VN [Vietnamese (Viet Nam)]... progress: 3% -> skipped

Done, without errors.
```

Here's the resulting content of the `web/languages` folder:
```
0 .gitignore
311959 cs_CZ/LC_MESSAGES/messages.mo
287476 da_DK/LC_MESSAGES/messages.mo
302404 de_DE/LC_MESSAGES/messages.mo
306510 es_AR/LC_MESSAGES/messages.mo
306035 es_ES/LC_MESSAGES/messages.mo
306045 es_PE/LC_MESSAGES/messages.mo
490433 fa_IR/LC_MESSAGES/messages.mo
306672 fi_FI/LC_MESSAGES/messages.mo
314407 fr_FR/LC_MESSAGES/messages.mo
302779 it_IT/LC_MESSAGES/messages.mo
478365 ja_JP/LC_MESSAGES/messages.mo
294357 nl_NL/LC_MESSAGES/messages.mo
304991 pt_PT/LC_MESSAGES/messages.mo
283249 ro_RO/LC_MESSAGES/messages.mo
575077 ru_RU/LC_MESSAGES/messages.mo
299353 sv_SE/LC_MESSAGES/messages.mo
311407 tr_TR/LC_MESSAGES/messages.mo
344019 zh_CN/LC_MESSAGES/messages.mo
```

That's a total of about 5.84 MB, but zipping them we have about 1.74 MB.