I have been working on a website in lua, and needed an internationalization library. I found
https://github.com/kikito/i18n.lua and decided others might find it useful, so I repackaged it in a mudlet mpackage. All credit goes to the original author. The full details are available on the github page but a basic rundown:
If you install this package, then given:
local translations = {
en = {
test = "This is a test",
emergency = "emergency",
},
de = {
test = "Das ist ein Test",
emergency = "Notfall",
}
}
i18n.load(translations)
i18n.setLocale('en-US')
Then you can run
cecho(string.format("<blue>(<red>%s<blue>)<reset> %s\n", i18n('emergency'), i18n('test')))
And it will look like this:
- Screenshot from 2019-10-03 21-56-13.png (5.94 KiB) Viewed 8224 times
If you do i18n.setLocale("de") and do it again, it will look like:
- Screenshot from 2019-10-03 22-01-29.png (5.79 KiB) Viewed 8224 times