2 intllib
= intllib
or {}
9 local function unescape(s
)
10 return s
:gsub("([\\]?)\\(.)", function(slash
, what
)
11 if slash
and (slash
~= "") then
14 return escapes
[what
] or what
19 local function find_eq(s
)
20 for slashes
, pos
in s
:gmatch("([\\]*)=()") do
21 if (slashes
:len() % 2) == 0 then
27 function intllib
.load_strings(filename
)
28 local file
, err
= io
.open(filename
, "r")
33 for line
in file
:lines() do
35 if line
~= "" and line
:sub(1, 1) ~= "#" then
36 local pos
= find_eq(line
)
38 local msgid
= unescape(line
:sub(1, pos
- 1):trim())
39 strings
[msgid
] = unescape(line
:sub(pos
+ 1):trim())