lua-users home
lua-l archive

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


On Fri, Feb 8, 2013 at 12:09 AM, Paul K <paulclinger@yahoo.com> wrote:
The translation file looks like this:

return {
  [0] = function(c) return c == 1 and 1 or 2 end, -- plural
  ["traced %d instruction"] = {"traced %d instruction", "traced %d
instructions"}, -- src\editor\debugger.lua
}

The pluralization rules are stored in the
language file itself and can be tweaked in any way you prefer.

The translated files for those curious are here:
https://github.com/pkulchenko/ZeroBraneStudio/tree/master/cfg/i18n

Paul.


Paul,
your pluralization function in ru.lua can be a bit simplified:

[0] = function(c) c = (c-9)%100 < 9 and 9 or (c-1)%10 return c == 0 and 1 or c < 4 and 2 or 3 end