aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/locale.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-03 19:39:02 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-03 19:39:02 -0500
commitfceb1a37df623649d191c3c1a881e5b0538b1391 (patch)
tree87a34dfc2397dc4afdaa0c8ec189f037300f458e /core/locale.lua
parent1618f5017abb3c9bacc9ba346bf22a936ef5dd06 (diff)
Added test suite and API type checking for more helpful error messages.
Diffstat (limited to 'core/locale.lua')
-rw-r--r--core/locale.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/locale.lua b/core/locale.lua
index 48de4af5..45a0f855 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -23,12 +23,12 @@ for line in f:lines() do
-- comment.
if not line:find('^%s*[^%w_%[]') then
local id, str = line:match('^(.-)%s*=%s*(.+)$')
- if id and str and assert(not M[id], 'duplicate locale key: '..id) then
+ if id and str and assert(not M[id], 'duplicate locale key "%s"', id) then
M[id] = not CURSES and str or str:gsub('_', '')
end
end
end
f:close()
-return setmetatable(M,
- {__index = function(_, k) return 'No Localization:'..k end})
+setmetatable(M, {__index = function(_, k) return 'No Localization:'..k end})
+return M