From 9a931009e44135b7a55130fc70e2b32db8bfe07f Mon Sep 17 00:00:00 2001 From: Oreolek Date: Sat, 15 Aug 2015 09:55:37 +0700 Subject: [PATCH] translate cache --- translate.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/translate.lua b/translate.lua index 5aa1b3c..33d0601 100644 --- a/translate.lua +++ b/translate.lua @@ -61,7 +61,7 @@ function load_mo_file(mo_file) hash[sub(mo_data,oo+1,oo+ol)]=sub(mo_data,to+1,to+tl) end return function(text) - return hash[text] or text + return hash[text] end end @@ -75,5 +75,8 @@ if LANG == translate.source then return text; end; else - __ = load_mo_file(LANG..'.mo'); + translate.strings = load_mo_file(LANG..'.mo'); + __ = function(text) + return translate.strings[text]; + end end