summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2013-12-17 20:29:01 -0500
committerShadowNinja <shadowninja@minetest.net>2013-12-17 20:29:01 -0500
commit4be14170e7d050dee610424a91a465633da71944 (patch)
tree577d4addf021c9297b127e2b2f13d29d6fb49226
parent934ca0492c264bce8467881b075bdc200a1b70fd (diff)
Localize load_strings
-rw-r--r--init.lua2
-rw-r--r--lib.lua4
-rw-r--r--tools/updatetext.lua4
3 files changed, 6 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index aa2af62..e63d709 100644
--- a/init.lua
+++ b/init.lua
@@ -26,7 +26,7 @@ function intllib.Getter(modname)
local modpath = minetest.get_modpath(modname)
if modpath then
local filename = modpath.."/locale/"..LANG..".txt"
- local msgstr = load_strings(filename)
+ local msgstr = intllib.load_strings(filename)
if msgstr then
intllib.getters[modname] = function (s)
if msgstr[s] and msgstr[s] ~= "" then
diff --git a/lib.lua b/lib.lua
index db6de0d..b3f183b 100644
--- a/lib.lua
+++ b/lib.lua
@@ -1,4 +1,6 @@
+intllib = intllib or {}
+
local escapes = {
["\\"] = "\\",
["n"] = "\n",
@@ -22,7 +24,7 @@ local function find_eq(s)
end
end
-function load_strings(filename)
+function intllib.load_strings(filename)
local file, err = io.open(filename, "r")
if not file then
return nil
diff --git a/tools/updatetext.lua b/tools/updatetext.lua
index 421ee12..00f9bf6 100644
--- a/tools/updatetext.lua
+++ b/tools/updatetext.lua
@@ -102,11 +102,11 @@ local function printf(fmt, ...)
io.stdout:write(fmt:format(...))
end
-local template_msgs = load_strings(template)
+local template_msgs = intllib.load_strings(template)
for _, file in ipairs(catalogs) do
print("Processing: "..file)
- local catalog_msgs = load_strings(file)
+ local catalog_msgs = intllib.load_strings(file)
local dirty_lines = { }
if catalog_msgs then
-- Add new entries from template.