aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/.gui.luadoc4
-rw-r--r--core/events.lua31
-rw-r--r--core/file_io.lua23
-rw-r--r--core/gui.lua11
-rwxr-xr-x[-rw-r--r--]core/locale.conf805
-rw-r--r--core/locale.lua15
6 files changed, 212 insertions, 677 deletions
diff --git a/core/.gui.luadoc b/core/.gui.luadoc
index eecc6c1d..9173b6e2 100644
--- a/core/.gui.luadoc
+++ b/core/.gui.luadoc
@@ -62,8 +62,8 @@ function check_focused_buffer(buffer) end
-- buffer, and prints to it.
-- @param buffer_type String type of message buffer.
-- @param ... Message strings.
--- @usage gui._print(locale.ERROR_BUFFER, error_message)
--- @usage gui._print(locale.MESSAGE_BUFFER, message)
+-- @usage gui._print(L('[Error Buffer]'), error_message)
+-- @usage gui._print(L('[Message Buffer]'), message)
function _print(buffer_type, ...) end
---
diff --git a/core/events.lua b/core/events.lua
index 96cb082b..4c67d37e 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local locale = _G.locale
+local L = _G.locale.localize
---
-- Textadept's core event structure and handlers.
@@ -294,7 +294,7 @@ connect('buffer_new',
-- @param buffer The currently focused buffer.
local function set_title(buffer)
local buffer = buffer
- local filename = buffer.filename or buffer._type or locale.UNTITLED
+ local filename = buffer.filename or buffer._type or L('Untitled')
local dirty = buffer.dirty and '*' or '-'
gui.title = string.format('%s %s Textadept (%s)', filename:match('[^/\\]+$'),
dirty, filename)
@@ -332,11 +332,8 @@ connect('uri_dropped',
end
end)
-local EOLs = {
- locale.STATUS_CRLF,
- locale.STATUS_CR,
- locale.STATUS_LF
-}
+local string_format = string.format
+local EOLs = { L('CRLF'), L('CR'), L('LF') }
local GETLEXERLANGUAGE = _SCINTILLA.functions.get_lexer_language[1]
connect('update_ui',
function() -- sets docstatusbar text
@@ -346,12 +343,12 @@ connect('update_ui',
local col = buffer.column[pos] + 1
local lexer = buffer:private_lexer_call(GETLEXERLANGUAGE)
local eol = EOLs[buffer.eol_mode + 1]
- local tabs = (buffer.use_tabs and locale.STATUS_TABS or
- locale.STATUS_SPACES)..buffer.indent
+ local tabs = string_format('%s %d', buffer.use_tabs and L('Tabs:') or
+ L('Spaces:'), buffer.indent)
local enc = buffer.encoding or ''
- gui.docstatusbar_text = locale.DOCSTATUSBAR_TEXT:format(line, max, col,
- lexer, eol, tabs,
- enc)
+ gui.docstatusbar_text =
+ string_format('%s %d/%d %s %d %s %s %s %s', L('Line:'),
+ line, max, L('Col:'), col, lexer, eol, tabs, enc)
end)
connect('margin_click',
@@ -415,18 +412,18 @@ connect('quit',
local list = {}
for _, buffer in ipairs(_BUFFERS) do
if buffer.dirty then
- list[#list + 1] = buffer.filename or buffer._type or locale.UNTITLED
+ list[#list + 1] = buffer.filename or buffer._type or L('Untitled')
any = true
end
end
if any and
gui.dialog('msgbox',
- '--title', locale.EVENTS_QUIT_TITLE,
- '--text', locale.EVENTS_QUIT_TEXT,
+ '--title', L('Quit without saving?'),
+ '--text', L('The following buffers are unsaved:'),
'--informative-text',
string.format('%s', table.concat(list, '\n')),
'--button1', 'gtk-cancel',
- '--button2', locale.EVENTS_QUIT_BUTTON2,
+ '--button2', L('Quit _without saving'),
'--no-newline') ~= '2' then
return false
end
@@ -446,4 +443,4 @@ if MAC then
end)
end
-connect('error', function(...) gui._print(locale.ERROR_BUFFER, ...) end)
+connect('error', function(...) gui._print(L('[Error Buffer]'), ...) end)
diff --git a/core/file_io.lua b/core/file_io.lua
index b395984a..89d3e5d7 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -1,6 +1,6 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local locale = _G.locale
+local L = _G.locale.localize
local events = _G.events
---
@@ -148,7 +148,7 @@ local function open_helper(utf8_filename)
break
end
end
- if not encoding then error(locale.IO_ICONV_ERROR) end
+ if not encoding then error(L('Encoding conversion failed.')) end
end
else
encoding = nil
@@ -190,7 +190,7 @@ end
function open_file(utf8_filenames)
utf8_filenames = utf8_filenames or
gui.dialog('fileselect',
- '--title', locale.IO_OPEN_TITLE,
+ '--title', L('Open'),
'--select-multiple',
'--with-directory',
(buffer.filename or ''):match('.+[/\\]') or '')
@@ -264,7 +264,7 @@ local function save_as(buffer, utf8_filename)
gui.check_focused_buffer(buffer)
if not utf8_filename then
utf8_filename = gui.dialog('filesave',
- '--title', locale.IO_SAVE_TITLE,
+ '--title', L('Save'),
'--with-directory',
(buffer.filename or ''):match('.+[/\\]') or '',
'--with-file',
@@ -297,13 +297,13 @@ local function close(buffer)
gui.check_focused_buffer(buffer)
if buffer.dirty and
gui.dialog('msgbox',
- '--title', locale.IO_CLOSE_TITLE,
- '--text', locale.IO_CLOSE_TEXT,
+ '--title', L('Close without saving?'),
+ '--text', L('There are unsaved changes in'),
'--informative-text',
string.format('%s', (buffer.filename or
- buffer._type or locale.UNTITLED)),
+ buffer._type or L('Untitled'))),
'--button1', 'gtk-cancel',
- '--button2', locale.IO_CLOSE_BUTTON2,
+ '--button2', L('Close _without saving'),
'--no-newline') ~= '2' then
return false
end
@@ -336,10 +336,11 @@ local function update_modified_file()
if not attributes then return end
if buffer.modification_time < attributes.modification then
if gui.dialog('yesno-msgbox',
- '--title', locale.IO_RELOAD_TITLE,
- '--text', locale.IO_RELOAD_TEXT,
+ '--title', L('Reload?'),
+ '--text', L('Reload modified file?'),
'--informative-text',
- string.format(locale.IO_RELOAD_MSG, utf8_filename),
+ string.format('"%s"\n%s', utf8_filename,
+ L('has been modified. Reload it?')),
'--no-cancel',
'--no-newline') == '1' then
buffer:reload()
diff --git a/core/gui.lua b/core/gui.lua
index b18b7afd..ef9892cc 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -1,13 +1,14 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
+local L = _G.locale.localize
local gui = _G.gui
-- LuaDoc is in core/.gui.lua.
function gui.check_focused_buffer(buffer)
if type(buffer) ~= 'table' or not buffer.doc_pointer then
- error(locale.ERR_BUFFER_EXPECTED, 2)
+ error(L('Buffer argument expected.'), 2)
elseif gui.focused_doc_pointer ~= buffer.doc_pointer then
- error(locale.ERR_BUFFER_NOT_FOCUSED, 2)
+ error(L('The indexed buffer is not the focused one.'), 2)
end
end
@@ -48,19 +49,19 @@ function gui._print(buffer_type, ...)
end
-- LuaDoc is in core/.gui.lua.
-function gui.print(...) gui._print(locale.MESSAGE_BUFFER, ...) end
+function gui.print(...) gui._print(L('[Message Buffer]'), ...) end
-- LuaDoc is in core/.gui.lua.
function gui.switch_buffer()
local items = {}
for _, buffer in ipairs(_BUFFERS) do
- local filename = buffer.filename or buffer._type or locale.UNTITLED
+ local filename = buffer.filename or buffer._type or L('Untitled')
local dirty = buffer.dirty and '*' or ''
items[#items + 1] = dirty..filename:match('[^/\\]+$')
items[#items + 1] = filename
end
local response = gui.dialog('filteredlist',
- '--title', locale.SWITCH_BUFFERS,
+ '--title', L('Switch Buffers'),
'--button1', 'gtk-ok',
'--button2', 'gtk-cancel',
'--no-newline',
diff --git a/core/locale.conf b/core/locale.conf
index d6df2c3f..c83a8023 100644..100755
--- a/core/locale.conf
+++ b/core/locale.conf
@@ -6,663 +6,196 @@
% you use the \ddd repesentation of characters, it must be in DECIMAL format,
% not Octal.
%
-% Each line contains a message ID (in capital letters) followed by the localized
-% string in double-quotation marks (""). The message ID should not be localized.
-% For reference, the first commented line is the file where the localized string
-% appears in; the second is the English version of the string.
+% Each line contains a "message = localized string" pair. The message should not
+% be localized. Extra spaces around '=' are ignored.
%
% Notes:
-% - Double quotations inside the localized string need not be escaped.
-% - Please do not localize the %d, %s, etc.
% - gtk-* strings do not need to be localized; GTK will do it for you based
% on your system's locale settings.
% - Menu items have a "_" character as a mnemonic (for Alt+character) access.
% You can put the "_" anywhere applicable in your localized version.
% core/events.lua
-% "Untitled"
-UNTITLED "Untitled"
-
-% core/events.lua
-% "[Message Buffer]"
-MESSAGE_BUFFER "[Message Buffer]"
-
-% core/events.lua
-% "CRLF"
-STATUS_CRLF "CRLF"
-
-% core/events.lua
-% "CR"
-STATUS_CR "CR"
-
-% core/events.lua
-% "LF"
-STATUS_LF "LF"
-
-% core/events.lua
-% "Tabs: "
-STATUS_TABS "Tabs: "
-
-% core/events.lua
-% "Spaces: "
-STATUS_SPACES "Spaces: "
-
-% core/events.lua
-% "Line: %d/%d Col: %d %s %s %s %s"
-DOCSTATUSBAR_TEXT "Line: %d/%d Col: %d %s %s %s %s"
-
-% core/events.lua
-% "Quit without saving?"
-EVENTS_QUIT_TITLE "Quit without saving?"
-
-% core/events.lua
-% "The following buffers are unsaved:"
-EVENTS_QUIT_TEXT "The following buffers are unsaved:"
-
-% core/events.lua
-% "Quit _without saving"
-EVENTS_QUIT_BUTTON2 "Quit _without saving"
-
-% core/events.lua
-% "[Error Buffer]"
-ERROR_BUFFER "[Error Buffer]"
-
-% core/file_io.lua
-% "Encoding conversion failed."
-IO_ICONV_ERROR "Encoding conversion failed."
-
-% core/file_io.lua
-% "Open"
-IO_OPEN_TITLE "Open"
-
-% core/file_io.lua
-% "Save"
-IO_SAVE_TITLE "Save"
-
-% core/file_io.lua
-% "Close without saving?"
-IO_CLOSE_TITLE "Close without saving?"
-
-% core/file_io.lua
-% "There are unsaved changes in"
-IO_CLOSE_TEXT "There are unsaved changes in"
-
-% core/file_io.lua
-% "Close _without saving"
-IO_CLOSE_BUTTON2 "Close _without saving"
-
-% core/file_io.lua
-% "Reload?"
-IO_RELOAD_TITLE "Reload?"
-
-% core/file_io.lua
-% "Reload modified file?"
-IO_RELOAD_TEXT "Reload modified file?"
+Untitled = Untitled
+[Message Buffer] = [Message Buffer]
+CRLF = CRLF
+CR = CR
+LF = LF
+Tabs: = Tabs:
+Spaces: = Spaces:
+Line: = Line:
+Col: = Col:
+Quit without saving? = Quit without saving?
+The following buffers are unsaved: = The following buffers are unsaved:
+Quit _without saving = Quit _without saving
+[Error Buffer] = [Error Buffer]
% core/file_io.lua
-% ""%s"\nhas been modified outside of Textadept.\nReload it to reflect the newest version?"
-IO_RELOAD_MSG ""%s"\nhas been modified outside of Textadept.\nReload it to reflect the newest version?"
-
-% core/init.lua
-% "Buffer argument expected."
-ERR_BUFFER_EXPECTED "Buffer argument expected."
-
-% core/init.lua
-% "The indexed buffer is not the focused one."
-ERR_BUFFER_NOT_FOCUSED "The indexed buffer is not the focused one."
-
-% core/init.lua
-% "Switch Buffers"
-SWITCH_BUFFERS "Switch Buffers"
-
-% modules/textadept/find.lua
-% Search wrapped
-FIND_SEARCH_WRAPPED "Search wrapped"
-
-% modules/textadept/find.lua
-% "No results found"
-FIND_NO_RESULTS "No results found"
-
-% modules/textadept/find.lua
-% "Error"
-FIND_ERROR_DIALOG_TITLE "Error"
-
-% modules/textadept/find.lua
-% "An error occured:"
-FIND_ERROR_DIALOG_TEXT "An error occured"
-
-% modules/textadept/find.lua
-% "%d replacement(s) made"
-FIND_REPLACEMENTS_MADE "%d replacement(s) made"
-
-% modules/textadept/find.lua
-% "Find in Files"
-FIND_IN_FILES_TITLE "Find in Files"
-
-% modules/textadept/find.lua
-% "[Files Found Buffer]"
-FIND_FILES_FOUND_BUFFER "[Files Found Buffer]"
-
-% modules/textadept/keys.lua
-% "Keychain: "
-KEYCHAIN "Keychain: "
-
-% modules/textadept/keys.lua
-% "Invalid sequence"
-KEYS_INVALID "Invalid sequence"
+Encoding conversion failed. = Encoding conversion failed.
+Open = Open
+Save = Save
+Close without saving? = Close without saving?
+There are unsaved changes in = There are unsaved changes in
+Close _without saving = Close _without saving
+Reload? = Reload?
+Reload modified file? = Reload modified file?
+has been modified. Reload it? = has been modified. Reload it?
+
+% core/gui.lua
+Buffer argument expected. = Buffer argument expected.
+The indexed buffer is not the focused one. = The indexed buffer is not the focused one.
+Switch Buffers = Switch Buffers
+Search wrapped = Search wrapped
+
+% core/find.lua
+No results found = No results found
+Error = Error
+An error occured: = An error occured:
+replacement(s) made = replacement(s) made
+Find in Files = Find in Files
+[Files Found Buffer] = [Files Found Buffer]
% modules/textadept/keys.lua
-% "Unknown command: "
-KEYS_UNKNOWN_COMMAND "Unknown command: "
-
-% modules/textadept/menu.lua
-% "_File"
-MENU_FILE_TITLE "_File"
-
-% modules/textadept/menu.lua
-% "gtk-new"
-MENU_FILE_NEW "gtk-new"
-
-% modules/textadept/menu.lua
-% "gtk-open"
-MENU_FILE_OPEN "gtk-open"
-
-% modules/textadept/menu.lua
-% "_Reload"
-MENU_FILE_RELOAD "_Reload"
-
-% modules/textadept/menu.lua
-% "gtk-save"
-MENU_FILE_SAVE "gtk-save"
-
-% modules/textadept/menu.lua
-% "gtk-save-as"
-MENU_FILE_SAVEAS "gtk-save-as"
-
-% modules/textadept/menu.lua
-% "gtk-close"
-MENU_FILE_CLOSE "gtk-close"
-
-% modules/textadept/menu.lua
-% "Close A_ll"
-MENU_FILE_CLOSE_ALL "Close A_ll"
-
-% modules/textadept/menu.lua
-% "Loa_d Session..."
-MENU_FILE_LOAD_SESSION "Loa_d Session..."
-
-% modules/textadept/menu.lua
-% "Sa_ve Session..."
-MENU_FILE_SAVE_SESSION "Sa_ve Session..."
-
-% modules/textadept/menu.lua
-% "gtk-quit"
-MENU_FILE_QUIT "gtk-quit"
-
-% modules/textadept/menu.lua
-% "_Edit"
-MENU_EDIT_TITLE "_Edit"
-
-% modules/textadept/menu.lua
-% "gtk-undo"
-MENU_EDIT_UNDO "gtk-undo"
-
-% modules/textadept/menu.lua
-% "gtk-redo"
-MENU_EDIT_REDO "gtk-redo"
-
-% modules/textadept/menu.lua
-% "gtk-cut"
-MENU_EDIT_CUT "gtk-cut"
-
-% modules/textadept/menu.lua
-% "gtk-copy"
-MENU_EDIT_COPY "gtk-copy"
-
-% modules/textadept/menu.lua
-% "gtk-paste"
-MENU_EDIT_PASTE "gtk-paste"
-
-% modules/textadept/menu.lua
-% "gtk-delete"
-MENU_EDIT_DELETE "gtk-delete"
-
-% modules/textadept/menu.lua
-% "gtk-select-all"
-MENU_EDIT_SELECT_ALL "gtk-select-all"
-
-% modules/textadept/menu.lua
-% "Match _Brace"
-MENU_EDIT_MATCH_BRACE "Match _Brace"
-
-% modules/textadept/menu.lua
-% "Select t_o Brace"
-MENU_EDIT_SELECT_TO_BRACE "Select t_o Brace"
-
-% modules/textadept/menu.lua
-% "Complete _Word"
-MENU_EDIT_COMPLETE_WORD "Complete _Word"
-
-% modules/textadept/menu.lua
-% "De_lete Word"
-MENU_EDIT_DELETE_WORD "De_lete Word"
-
-% modules/textadept/menu.lua
-% "Tran_spose Characters"
-MENU_EDIT_TRANSPOSE_CHARACTERS "Tran_spose Characters"
-
-% modules/textadept/menu.lua
-% "S_queeze"
-MENU_EDIT_SQUEEZE "S_queeze"
-
-% modules/textadept/menu.lua
-% "_Join Lines"
-MENU_EDIT_JOIN_LINES "_Join Lines"
-
-% modules/textadept/menu.lua
-% "Convert _Indentation"
-MENU_EDIT_CONVERT_INDENTATION "Convert _Indentation"
-
-% modules/textadept/menu.lua
-% "S_election"
-MENU_EDIT_SEL_TITLE "S_election"
-
-% modules/textadept/menu.lua
-% "_Enclose in..."
-MENU_EDIT_SEL_ENC_TITLE "_Enclose in..."
-
-% modules/textadept/menu.lua
-% "_HTML Tags"
-MENU_EDIT_SEL_ENC_HTML_TAGS "_HTML Tags"
-
-% modules/textadept/menu.lua
-% "HTML Single _Tag"
-MENU_EDIT_SEL_ENC_HTML_SINGLE_TAG "HTML Single _Tag"
-
-% modules/textadept/menu.lua
-% "_Double Quotes"
-MENU_EDIT_SEL_ENC_DOUBLE_QUOTES "_Double Quotes"
-
-% modules/textadept/menu.lua
-% "_Single Quotes"
-MENU_EDIT_SEL_ENC_SINGLE_QUOTES "_Single Quotes"
-
-% modules/textadept/menu.lua
-% "_Parentheses"
-MENU_EDIT_SEL_ENC_PARENTHESES "_Parentheses"
-
-% modules/textadept/menu.lua
-% "_Brackets"
-MENU_EDIT_SEL_ENC_BRACKETS "_Brackets"
-
-% modules/textadept/menu.lua
-% "B_races"
-MENU_EDIT_SEL_ENC_BRACES "B_races"
-
-% modules/textadept/menu.lua
-% "_Character Sequence"
-MENU_EDIT_SEL_ENC_CHAR_SEQ "_Character Sequence"
-
-% modules/textadept/menu.lua
-% "_Grow"
-MENU_EDIT_SEL_GROW "_Grow"
-
-% modules/textadept/menu.lua
-% "Select i_n..."
-MENU_EDIT_SEL_IN_TITLE "Select i_n..."
-
-% modules/textadept/menu.lua
-% "_HTML Tag"
-MENU_EDIT_SEL_IN_HTML_TAG "_HTML Tag"
-
-% modules/textadept/menu.lua
-% "_Double Quote"
-MENU_EDIT_SEL_IN_DOUBLE_QUOTE "_Double Quote"
-
-% modules/textadept/menu.lua
-% "_Single Quote"
-MENU_EDIT_SEL_IN_SINGLE_QUOTE "_Single Quote"
-
-% modules/textadept/menu.lua
-% "_Parenthesis"
-MENU_EDIT_SEL_IN_PARENTHESIS "_Parenthesis"
-
-% modules/textadept/menu.lua
-% "_Bracket"
-MENU_EDIT_SEL_IN_BRACKET "_Bracket"
-
-% modules/textadept/menu.lua
-% "B_race"
-MENU_EDIT_SEL_IN_BRACE "B_race"
-
-% modules/textadept/menu.lua
-% "_Word"
-MENU_EDIT_SEL_IN_WORD "_Word"
-
-% modules/textadept/menu.lua
-% "_Line"
-MENU_EDIT_SEL_IN_LINE "_Line"
-
-% modules/textadept/menu.lua
-% "Para_graph"
-MENU_EDIT_SEL_IN_PARAGRAPH "Para_graph"
-
-% modules/textadept/menu.lua
-% "_Indented Block"
-MENU_EDIT_SEL_IN_INDENTED_BLOCK "_Indented Block"
-
-% modules/textadept/menu.lua
-% "S_cope"
-MENU_EDIT_SEL_IN_SCOPE "S_cope"
-
-% modules/textadept/menu.lua
-% "_Tools"
-MENU_TOOLS_TITLE "_Tools"
-
-% modules/textadept/menu.lua
-% "_Find"
-MENU_TOOLS_SEARCH_TITLE "_Find"
-
-% modules/textadept/menu.lua
-% "gtk-find"
-MENU_TOOLS_SEARCH_FIND "gtk-find"
-
-% modules/textadept/menu.lua
-% "Find _Next"
-MENU_TOOLS_SEARCH_FIND_NEXT "Find _Next"
-
-% modules/textadept/menu.lua
-% "Find _Previous"
-MENU_TOOLS_SEARCH_FIND_PREV "Find _Previous"
-
-% modules/textadept/menu.lua
-% "gtk-find-and-replace"
-MENU_TOOLS_SEARCH_FIND_AND_REPLACE "gtk-find-and-replace"
-
-% modules/textadept/menu.lua
-% "Replace"
-MENU_TOOLS_SEARCH_REPLACE "Replace"
-
-% modules/textadept/menu.lua
-% "Replace _All"
-MENU_TOOLS_SEARCH_REPLACE_ALL "Replace _All"
-
-% modules/textadept/menu.lua
-% "Find _Incremental"
-MENU_TOOLS_SEARCH_FIND_INCREMENTAL "Find _Incremental"
-
-% modules/textadept/menu.lua
-% "Find in Fi_les"
-MENU_TOOLS_SEARCH_FIND_IN_FILES "Find in Fi_les"
-
-% modules/textadept/menu.lua
-% "Goto Next File Found"
-MENU_TOOLS_SEARCH_GOTO_NEXT_FILE_FOUND "Goto Next File Found"
-
-% modules/textadept/menu.lua
-% "Goto Previous File Found"
-MENU_TOOLS_SEARCH_GOTO_PREV_FILE_FOUND "Goto Previous File Found"
-
-% modules/textadept/menu.lua
-% "gtk-jump-to"
-MENU_TOOLS_SEARCH_GOTO_LINE "gtk-jump-to"
-
-% modules/textadept/menu.lua
-% "Command _Entry"
-MENU_TOOLS_FOCUS_COMMAND_ENTRY "Command _Entry"
-
-% modules/textadept/menu.lua
-% "_Run"
-MENU_TOOLS_RUN "_Run"
-
-% modules/textadept/menu.lua
-% "_Compile"
-MENU_TOOLS_COMPILE "_Compile"
-
-% modules/textadept/menu.lua
-% "_Snippets"
-MENU_TOOLS_SNIPPETS_TITLE "_Snippets"
-
-% modules/textadept/menu.lua
-% "_Insert Snippet"
-MENU_TOOLS_SNIPPETS_INSERT "_Insert"
-
-% modules/textadept/menu.lua
-% "_Previous Placeholder"
-MENU_TOOLS_SNIPPETS_PREV_PLACE "_Previous Placeholder"
-
-% modules/textadept/menu.lua
-% "_Cancel"
-MENU_TOOLS_SNIPPETS_CANCEL "_Cancel"
-
-% modules/textadept/menu.lua
-% "_List"
-MENU_TOOLS_SNIPPETS_LIST "_List"
-
-% modules/textadept/menu.lua
-% "_Show Scope"
-MENU_TOOLS_SNIPPETS_SHOW_SCOPE "_Show Scope"
-
-% modules/textadept/menu.lua
-% "_Bookmark"
-MENU_TOOLS_BM_TITLE "_Bookmark"
-
-% modules/textadept/menu.lua
-% "_Toggle on Current Line"
-MENU_TOOLS_BM_TOGGLE "_Toggle on Current Line"
-
-% modules/textadept/menu.lua
-% "_Clear All"
-MENU_TOOLS_BM_CLEAR_ALL "_Clear All"
-
-% modules/textadept/menu.lua
-% "_Next"
-MENU_TOOLS_BM_NEXT "_Next"
-
-% modules/textadept/menu.lua
-% "_Previous"
-MENU_TOOLS_BM_PREV "_Previous"
-
-% modules/textadept/menu.lua
-% "Snap_open"
-MENU_TOOLS_SNAPOPEN_TITLE "Snap_open"
-
-% modules/textadept/menu.lua
-% "Snap_open"
-MENU_TOOLS_SNAPOPEN_USERHOME "_User Home"
-
-% modules/textadept/menu.lua
-% "Snap_open"
-MENU_TOOLS_SNAPOPEN_HOME "_Textadept Home"
-
-% modules/textadept/menu.lua
-% "Snap_open"
-MENU_TOOLS_SNAPOPEN_CURRENTDIR "_Current Directory"
-
-% modules/textadept/menu.lua
-% "_Buffer"
-MENU_BUF_TITLE "_Buffer"
-
-% modules/textadept/menu.lua
-% "_Next Buffer"
-MENU_BUF_NEXT "_Next Buffer"
-
-% modules/textadept/menu.lua
-% "_Previous Buffer"
-MENU_BUF_PREV "_Previous Buffer"
-
-% modules/textadept/menu.lua
-% "S_witch Buffer"
-MENU_BUF_SWITCH "Swit_ch Buffer"
-
-% modules/textadept/menu.lua
-% "Toggle View _EOL"
-MENU_BUF_TOGGLE_VIEW_EOL "Toggle View _EOL"
-
-% modules/textadept/menu.lua
-% "Toggle _Wrap Mode"
-MENU_BUF_TOGGLE_WRAP "Toggle _Wrap Mode"
-
-% modules/textadept/menu.lua
-% "Toggle Show _Indentation Guides"
-MENU_BUF_TOGGLE_INDENT_GUIDES "Toggle Show _Indentation Guides"
-
-% modules/textadept/menu.lua
-% "Toggle Use _Tabs"
-MENU_BUF_TOGGLE_TABS "Toggle Use _Tabs"
-
-% modules/textadept/menu.lua
-% "Toggle View White_space"
-MENU_BUF_TOGGLE_VIEW_WHITESPACE "Toggle View White_space"
-
-% modules/textadept/menu.lua
-% "EOL Mode"
-MENU_BUF_EOL_MODE_TITLE "EOL Mode"
-
-% modules/textadept/menu.lua
-% "CR+LF"
-MENU_BUF_EOL_MODE_CRLF "CR+LF"
-
-% modules/textadept/menu.lua
-% "CR"
-MENU_BUF_EOL_MODE_CR "CR"
-
-% modules/textadept/menu.lua
-% "LF"
-MENU_BUF_EOL_MODE_LF "LF"
-
-% modules/textadept/menu.lua
-% "Encoding"
-MENU_BUF_ENCODING_TITLE "Encoding"
-
-% modules/textadept/menu.lua
-% "UTF-8"
-MENU_BUF_ENCODING_UTF8 "UTF-8"
-
-% modules/textadept/menu.lua
-% "ASCII"
-MENU_BUF_ENCODING_ASCII "ASCII"
-
-% modules/textadept/menu.lua
-% "ISO-8859-1"
-MENU_BUF_ENCODING_ISO88591 "ISO-8859-1"
-
-% modules/textadept/menu.lua
-% "MacRoman"
-MENU_BUF_ENCODING_MACROMAN "MacRoman"
-
-% modules/textadept/menu.lua
-% "UTF-16"
-MENU_BUF_ENCODING_UTF16 "UTF-16"
-
-% modules/textadept/menu.lua
-% "_Refresh Syntax Highlighting"
-MENU_BUF_REFRESH "_Refresh Syntax Highlighting"
-
-% modules/textadept/menu.lua
-% "_View"
-MENU_VIEW_TITLE "_View"
-
-% modules/textadept/menu.lua
-% "_Next View"
-MENU_VIEW_NEXT "_Next View"
-
-% modules/textadept/menu.lua
-% "_Previous View"
-MENU_VIEW_PREV "_Previous View"
-
-% modules/textadept/menu.lua
-% "Split _Vertical"
-MENU_VIEW_SPLIT_VERTICAL "Split _Vertical"
-
-% modules/textadept/menu.lua
-% "Split _Horizontal"
-MENU_VIEW_SPLIT_HORIZONTAL "Split _Horizontal"
-
-% modules/textadept/menu.lua
-% "_Unsplit"
-MENU_VIEW_UNSPLIT "_Unsplit"
-
-% modules/textadept/menu.lua
-% "Unsplit _All"
-MENU_VIEW_UNSPLIT_ALL "Unsplit _All"
-
-% modules/textadept/menu.lua
-% "_Grow"
-MENU_VIEW_GROW "_Grow"
-
-% modules/textadept/menu.lua
-% "_Shrink"
-MENU_VIEW_SHRINK "_Shrink"
-
-% modules/textadept/menu.lua
-% "Le_xers"
-MENU_LEX_TITLE "Le_xers"
-
-% modules/textadept/menu.lua
-% "_Help"
-MENU_HELP_TITLE "_Help"
-
-% modules/textadept/menu.lua
-% "_Manual"
-MENU_HELP_MANUAL "_Manual"
-
-% modules/textadept/menu.lua
-% "_LuaDoc"
-MENU_HELP_LUADOC "_LuaDoc"
-
-% modules/textadept/menu.lua
-% "gtk-about"
-MENU_HELP_ABOUT "gtk-about"
-
-% modules/textadept/menu.lua
-% "Error loading webpage: "
-MENU_BROWSER_ERROR "Error loading webpage: "
-
-% modules/textadept/menu.lua
-% "Load Session"
-MENU_LOAD_SESSION_TITLE "Load Session"
-
-% modules/textadept/menu.lua
-% "Save Session"
-MENU_SAVE_SESSION_TITLE "Save Session"
-
-% modules/textadept/menu.lua
-% "Unknown command: "
-MENU_UNKNOWN_COMMAND "Unknown command: "
+Keychain: = Keychain:
+Invalid sequence = Invalid sequence
+Unknown command: = Unknown command:
+
+% modules/textadept/menu.lua
+_File = _File
+gtk-new = gtk-new
+gtk-open = gtk-open
+_Reload = _Reload
+gtk-save = gtk-save
+gtk-save-as = gtk-save-as
+gtk-close = gtk-close
+Close A_ll = Close A_ll
+Loa_d Session... = Loa_d Session...
+Sa_ve Session... = Sa_ve Session...
+gtk-quit = gtk-quit
+
+_Edit = _Edit
+gtk-undo = gtk-undo
+gtk-redo = gtk-redo
+gtk-cut = gtk-cut
+gtk-copy = gtk-copy
+gtk-paste = gtk-paste
+gtk-delete = gtk-delete
+gtk-select-all = gtk-select-all
+Match _Brace = Match _Brace
+Select t_o Brace = Select t_o Brace
+Complete _Word = Complete _Word
+De_lete Word = De_lete Word
+Tran_spose Characters = Tran_spose Characters
+_Join Lines = _Join Lines
+Convert _Indentation = Convert _Indentation
+S_election = S_election
+_Enclose in... = _Enclose in...
+_HTML Tags = _HTML Tags
+HTML Single _Tag = HTML Single _Tag
+_Double Quotes = _Double Quotes
+_Single Quotes = _Single Quotes
+_Parentheses = _Parentheses
+_Brackets = _Brackets
+B_races = B_races
+_Character Sequence = _Character Sequence
+_Grow = _Grow
+Select i_n... = Select i_n...
+_HTML Tag = _HTML Tag
+_Double Quote = _Double Quote
+_Single Quote = _Single Quote
+_Parenthesis = _Parenthesis
+_Bracket = _Bracket
+B_race = B_race
+_Word = _Word
+_Line = _Line
+Para_graph = Para_graph
+_Indented Block = _Indented Block
+S_cope = S_cope
+_Tools = _Tools
+_Find = _Find
+gtk-find = gtk-find
+Find _Next = Find _Next
+Find _Previous = Find _Previous
+gtk-find-and-replace = gtk-find-and-replace
+Replace = Replace
+Replace _All = Replace _All
+Find _Incremental = Find _Incremental
+Find in Fi_les = Find in Fi_les
+Goto Next File Found = Goto Next File Found
+Goto Previous File Found = Goto Previous File Found
+gtk-jump-to = gtk-jump-to
+Command _Entry = Command _Entry
+_Run = _Run
+_Compile = _Compile
+_Snippets = _Snippets
+_Insert = _Insert
+_Previous Placeholder = _Previous Placeholder
+_Cancel = _Cancel
+_List = _List
+_Show Scope = _Show Scope
+_Bookmark = _Bookmark
+_Toggle on Current Line = _Toggle on Current Line
+_Clear All = _Clear All
+_Next = _Next
+_Previous = _Previous
+Snap_open = Snap_open
+_User Home = _User Home
+_Textadept Home = _Textadept Home
+_Current Directory = _Current Directory
+_Buffer = _Buffer
+_Next Buffer = _Next Buffer
+_Previous Buffer = _Previous Buffer
+Swit_ch Buffer = Swit_ch Buffer
+Toggle View _EOL = Toggle View _EOL
+Toggle _Wrap Mode = Toggle _Wrap Mode
+Toggle Show _Indentation Guides = Toggle Show _Indentation Guides
+Toggle Use _Tabs = Toggle Use _Tabs
+Toggle View White_space = Toggle View White_space
+EOL Mode = EOL Mode
+Encoding = Encoding
+UTF-8 = UTF-8
+ASCII = ASCII
+ISO-8859-1 = ISO-8859-1
+MacRoman = MacRoman
+UTF-16 = UTF-16
+_Refresh Syntax Highlighting = _Refresh Syntax Highlighting
+_View = _View
+_Next View = _Next View
+_Previous View = _Previous View
+Split _Vertical = Split _Vertical
+Split _Horizontal = Split _Horizontal
+_Unsplit = _Unsplit
+Unsplit _All = Unsplit _All
+_Grow = _Grow
+_Shrink = _Shrink
+Le_xers = Le_xers
+_Help = _Help
+_Manual = _Manual
+_LuaDoc = _LuaDoc
+gtk-about = gtk-about
+Error loading webpage: = Error loading webpage:
+Load Session = Load Session
+Save Session = Save Session
+Unknown command: = Unknown command:
% modules/textadept/mime_types.lua
-% "Select Lexer"
-MT_SELECT_LEXER "Select Lexer"
-
-% modules/textadept/editing.lua
-% "Go To"
-M_TEXTADEPT_EDITING_GOTO_TITLE "Go To"
+Select Lexer = Select Lexer
% modules/textadept/editing.lua
-% "Line Number:"
-M_TEXTADEPT_EDITING_GOTO_TEXT "Line Number:"
+Go To = Go To
+Line Number: = Line Number:
% modules/textadept/run.lua
-% "The file "%s" does not exist."
-M_TEXTADEPT_RUN_FILE_DOES_NOT_EXIST "The file "%s" does not exist."
+does not exist = does not exist
% modules/textadept/snippets.lua
-% "Lexer %s\nStyle %s (%d)"
-M_TEXTADEPT_SNIPPETS_SHOW_STYLE "Lexer %s\nStyle %s (%d)"
+Lexer = Lexer
+Style = Style
% modules/textadept/session.lua
-% "Session Files Not Found"
-M_SESSION_FILES_NOT_FOUND_TITLE "Session Files Not Found"
-
-% modules/textadept/session.lua
-% "The following session files were not found"
-M_SESSION_FILES_NOT_FOUND_TEXT "The following session files were not found"
-
-% modules/textadept/snapopen.lua
-% "File Limit Exceeded"
-M_SNAPOPEN_LIMIT_EXCEEDED_TITLE "File Limit Exceeded"
+Session Files Not Found = Session Files Not Found
+The following session files were not found = The following session files were not found
% modules/textadept/snapopen.lua
-% "%s files or more were found. Showing the first %s."
-M_SNAPOPEN_LIMIT_EXCEEDED_TEXT "%s files or more were found. Showing the first %s."
+File Limit Exceeded = File Limit Exceeded
+files or more were found. Showing the first = files or more were found. Showing the first
diff --git a/core/locale.lua b/core/locale.lua
index 93bf1024..5b14a254 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -19,20 +19,23 @@ module('locale', package.seeall)
-- Each message ID in `core/locale.conf` is accessible as a field in this
-- module.
-local escapes = { ['\\n'] = '\n', ['\\r'] = '\r', ['\\t'] = '\t' }
+-- Contains all localizations for the current locale.
+-- @class table
+-- @name localizations
+local localizations = {}
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+)%s+"(.+)"$')
- if id and str then locale[id] = str:gsub('\\[nrt]', escapes) end
+ local id, str = line:match('^(.-)%s*=%s*(.+)$')
+ if id and str then localizations[id] = str end
end
end
f:close()
---
--- This module contains no functions.
-function no_functions() end
-no_functions = nil -- undefine
+-- Localizes the given string.
+-- @param id String to localize.
+function localize(id) return localizations[id] or 'No Localization' end