aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/locale.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-02-21 13:44:39 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-02-21 13:44:39 -0500
commitb4a67ffb3aedafcd778ad853246f8119f7e5e9e6 (patch)
tree4fbf98c50600d2e7045747bd2037996bd00ba355 /core/locale.lua
parent24d5a0503683f2367d2110c559bbbce81777bd6a (diff)
Tweaked localization keys.
This is in anticipate of removing '_' from keys, which would have created duplicate keys.
Diffstat (limited to 'core/locale.lua')
-rw-r--r--core/locale.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/locale.lua b/core/locale.lua
index 919f9743..2c94ef1c 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -7,6 +7,8 @@ local M = {}
-- Map of all messages used by Textadept to their localized form.
-- If the table does not contain the localized version of a given message, it
-- returns a string that starts with "No Localization:" via a metamethod.
+-- Note: the terminal version ignores any "_" mnemonics the GUI version would
+-- use.
module('_L')]]
local f = io.open(_USERHOME..'/locale.conf', 'rb')
@@ -21,7 +23,9 @@ 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 then M[id] = not CURSES and str or str:gsub('_', '') end
+ if id and str and assert(not M[id], 'duplicate locale key: '..id) then
+ M[id] = not CURSES and str or str:gsub('_', '')
+ end
end
end
f:close()