Merge: i18n annotation
authorJean Privat <jean@pryen.org>
Tue, 5 May 2015 01:09:46 +0000 (21:09 -0400)
committerJean Privat <jean@pryen.org>
Tue, 5 May 2015 01:09:46 +0000 (21:09 -0400)
So here's the POC of a new annotation for the compiler: i18n !

Right now, you can append it to a module declaration with the locale of your choice.

It then generates a .pot template file and a .po file for the language you chose when defining your module.

The generation of the corresponding .mo (using msgfmt) file is still of the responsability of the user.

There's still several modifications to do for real usability, namely the support of superstrings, the possibility to untranslate a literal string via some kind of notranslate annotation (though if no translation is found, the key is kept as argument, so this should not be an issue).

So now, when using another value for the $LANGUAGE environment value, a different message will be printed when executing a Nit program, have fun !

NOTE: I have not yet added a test since I'm not sure how we should proceed. I guess we could just try to generate a .po file and .mo file for the example with a bash script and change the locale on the test server, I'm not sure how to do so, if you have an idea, please let me know.

Pull-Request: #1289
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>


Trivial merge