1
0
mirror of https://github.com/minetest-mods/intllib.git synced 2025-07-04 09:00:21 +02:00

Fix warnings issued by luacheck.

This commit is contained in:
Diego Martínez
2017-02-11 01:56:54 -03:00
parent c667cd0de6
commit 122d1a83cc
5 changed files with 17 additions and 30 deletions

View File

@ -1,7 +1,6 @@
local strfind, strsub, strrep = string.find, string.sub, string.rep
local strmatch, strgsub = string.match, string.gsub
local floor = math.floor
local function split(str, sep)
local pos, endp = 1, #str+1
@ -103,6 +102,7 @@ local function parse_po(str)
return perror("malformed line")
-- luacheck: ignore
until true end -- end for
return texts
@ -110,9 +110,6 @@ end
local M = { }
local domains = { }
local dgettext_cache = { }
local dngettext_cache = { }
local langs
local function detect_languages()
@ -166,8 +163,8 @@ end
-- Note that it assumes the C expression is valid to begin with.
local function compile_plural_forms(str)
local plural = strmatch(str, "plural=([^;]+);?$")
local function replace_ternary(str)
local c, t, f = strmatch(str, "^(.-)%?(.-):(.*)")
local function replace_ternary(s)
local c, t, f = strmatch(s, "^(.-)%?(.-):(.*)")
if c then
return ("__if("
..replace_ternary(c)
@ -175,7 +172,7 @@ local function compile_plural_forms(str)
..","..replace_ternary(f)
..")")
end
return str
return s
end
plural = replace_ternary(plural)
plural = strgsub(plural, "&&", " and ")