From b4a67ffb3aedafcd778ad853246f8119f7e5e9e6 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 21 Feb 2020 13:44:39 -0500 Subject: Tweaked localization keys. This is in anticipate of removing '_' from keys, which would have created duplicate keys. --- core/locale.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'core/locale.lua') 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() -- cgit v1.2.3