aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/locale.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-10-20 15:29:03 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-10-20 15:29:03 -0400
commit03c4016d07477781aa3adcc9edf340c0bec9c6c8 (patch)
treed3be089e9020807326a4e56562876ecb7bcf7892 /core/locale.lua
parentb682fbd4a6e53185e2556686079532ad0e42be94 (diff)
Code cleanup.
Of note: * io.save_all_files() does not visit each buffer to save anymore. An unintended side-effect was checking for outside modification (but only if the file itself was modified), so outside changes will always be saved over now. * The menu clicked handler uses assert_type(), so the 'Unknown command' localization is no longer needed. * When printing to a new buffer type would split the view, use an existing split view when possible. * Prefer 'goto continue' construct in loops over nested 'if's. * Fixed clearing of ui.find.replace_entry_text on reset in the GUI version. * Fixed lack of statusbar updating when setting options like buffer EOL mode, indentation, and encoding. * Renamed internal new_snippet() to new() and put it in the snippet metatable.
Diffstat (limited to 'core/locale.lua')
-rw-r--r--core/locale.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/locale.lua b/core/locale.lua
index 48701116..3a661fae 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -23,14 +23,14 @@ assert(f, '"core/locale.conf" not found')
for line in f:lines() do
-- Any line that starts with a non-word character except '[' is considered a
-- comment.
- if not line:find('^%s*[^%w_%[]') then
- local id, str = line:match('^(.-)%s*=%s*(.-)\r?$')
- 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
+ if not line:find('^%s*[%w_%[]') then goto continue end
+ local id, str = line:match('^(.-)%s*=%s*(.-)\r?$')
+ 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
+ ::continue::
end
f:close()
-setmetatable(M, {__index = function(_, k) return 'No Localization:' .. k end})
-return M
+return setmetatable(
+ M, {__index = function(_, k) return 'No Localization:' .. k end})