diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/locale.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/locale.lua b/core/locale.lua index 1763f396..8c838ecc 100644 --- a/core/locale.lua +++ b/core/locale.lua @@ -5,11 +5,15 @@ local M = {} --[[ This comment is for LuaDoc. --- -- Table of all messages used by Textadept for localization. --- @field _NIL (string) --- String returned when no localization for a given message exists. module('_L')]] -M._NIL = 'No Localization' +local none = 'No Localization: ' + +--- +-- Returns whether or not a localized message exists for the given message. +-- @param message The message to localize. +-- @return `true` if a localization exists, `false` otherwise. +function M._EXISTS(message) return M[message] ~= none..message end local f = io.open(_USERHOME..'/locale.conf', 'rb') if not f then f = io.open(_HOME..'/core/locale.conf', 'rb') end @@ -22,4 +26,4 @@ for line in f:lines() do end f:close() -return setmetatable(M, { __index = function(t, k) return M._NIL..': '..k end }) +return setmetatable(M, { __index = function(t, k) return none..k end }) |