[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: i18n in Lua
- From: Mateusz Czaplinski <czapkofan@...>
- Date: Thu, 13 Jan 2011 15:59:28 +0100
On Thu, Jan 13, 2011 at 2:36 AM, Robert G. Jakabosky
> or you could use a function to make the lookup nicer:
> current_locale = "en_US"
> t = function(text)
> local tr_locale = tr[current_locale] or tr.default
> return tr_locale[text] or text
> Instead of a function named t you could use an underscore _. I think some
> C/C++ based translation library (maybe QT) uses this _("hello") for
> translating text.
Uh oh, maybe unless you commonly use _ as a marker for "dummy variable
to assign to", as in:
for _, v in ipairs(tab) do --[[ something ]]-- end
local x, _, z = fooBar()
- then I wouldn't advise _ for i18n as you might get some some issues
because of variable scoping...
Actually, I thought this use of _ (as "dummy") is common and suggested
by PIL, but now after what you wrote, I'm starting to lose my
certainity... do I regularly follow some non-standard practice?