lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Dec 13, 2007 6:35 AM, Brett Kugler <> wrote:
> First I have stringent memory limits I must stay within.  My concern with
> creating new variables for each string would be that my heap burden would
> grow significantly.

If that's a concern then you don't want to have every translation in
memory at the same time, as all the schemes we've been playing around
with have done.

The real KISS approach is just to load a file like:

   -- localizations.lua
   if language == "German" then
      DidNotWork = "Operasie het nie geslaag nie"
      NoAnswer = "Antwoord nie gefind nie"
   elseif language == "Martian" then
      DidNotWork = "Pqfsbtjf!ifu!ojf!hftmbbh!ojf"
      NoAnswer = "Bouxppse!ojf!hfgjoe!ojf"
   else -- default to English
      DidNotWork = "Operation did not succeed"
      NoAnswer = "No answer found"

   -- yourapp.lua
   language = "German"

Then you have *one* set of text and some relatively short identifier
names loaded in memory.