I think I've figured out a decent solution for internationalizing KonOpas, and e.g. http://dev.konopas.org now mostly speaks Swedish. The source file for that translation is http://dev.konopas.org/i18n/sv.json, which is preprocessed into http://dev.konopas.org/src/i18n.js. I have an English alternative as well, but figured the Swedish would be better for effect. :)
The markup language used is ICU MessageFormat, for which I found a great preprocessor (https://github.com/SlexAxton/messageformat.js). Which I've now hacked at quite a bit this weekend so the output is as clean as you see above; the changes aren't merged into the official repo yet, but you can get my latest version here: https://github.com/eemeli/messageformat.js/tree/functions
I picked MessageFormat because it seems both simple and powerful. It handles three different variable substitution patterns, using VAR as an example variable:
{VAR} gets replaced with the string value of the variable.
{VAR, select, a{first} bee{some thing} other{silly {VAR}-ness}} is pretty much a switch statement. Note the unlimited recursion and repetition.
{VAR, plural, =0{nada} one{just one} other {plenty, # in fact}} assumes that it's getting a number, and maps the choices according to locale-specific rules about how plural forms are handled (the output construction can be different for different languages). # gets replaced by the number itself.
I'll see if I can put up an online instance of the pre- processor under konopas.org/util/.
Eemeli
--
You received this message because you are subscribed to the Google Groups "KonOpas Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konopas-dev...@googlegroups.com.
To post to this group, send email to konop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
eemeli