aboutsummaryrefslogtreecommitdiff
path: root/core/locale.lua
blob: 1ba3a8f1f353a5551f124106fec0b798e3b0426e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- Copyright 2007-2011 Mitchell mitchell<att>caladbolg.net. See LICENSE.

local M = {}

local f = io.open(_USERHOME..'/locale.conf', 'rb')
if not f then f = io.open(_HOME..'/core/locale.conf', 'rb') end
if not f then error('"core/locale.conf" not found.') end
for line in f:lines() do
  if not line:find('^%s*%%') then
    local id, str = line:match('^(.-)%s*=%s*(.+)$')
    if id and str then M[id] = str end
  end
end
f:close()

return setmetatable(M, { __index = function() return 'No Localization' end })