diff options
author | 2009-01-03 22:50:12 -0500 | |
---|---|---|
committer | 2009-01-03 22:50:12 -0500 | |
commit | c15e9a9cf36da02cb883eb14fd3a4ee23548f675 (patch) | |
tree | be8de81c387208fa5011399d31df5c772e626f50 /core/file_io.lua | |
parent | fd48dede42c0678e4a5410bd635a02d255fe89d6 (diff) | |
download | textadept-c15e9a9cf36da02cb883eb14fd3a4ee23548f675.tar.gz textadept-c15e9a9cf36da02cb883eb14fd3a4ee23548f675.zip |
Added localization support.
All Textadept messages are in core/locale.lua which provides the new
'textadept.locale' module.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 42766e7a..44fbe444 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -44,9 +44,10 @@ end -- specified, the user is prompted to open files from a dialog. -- @usage textadept.io.open(filename) function open(filenames) + local locale = textadept.locale filenames = filenames or cocoa_dialog( 'fileselect', { - title = 'Open', - text = 'Select a file(s) to open', + title = locale.IO_OPEN_TITLE, + text = locale.IO_OPEN_TEXT, -- in Windows, dialog:get_filenames() is unavailable; only allow single -- selection ['select-multiple'] = not WIN32 or nil, @@ -103,7 +104,7 @@ function save_as(buffer, filename) textadept.check_focused_buffer(buffer) if not filename then filename = cocoa_dialog( 'filesave', { - title = 'Save', + title = textadept.locale.IO_SAVE_TITLE, ['with-directory'] = (buffer.filename or ''):match('.+[/\\]'), ['with-file'] = (buffer.filename or ''):match('[^/\\]+$'), ['no-newline'] = true @@ -138,11 +139,12 @@ end -- buffer. -- @usage buffer:close() function close(buffer) + local locale = textadept.locale textadept.check_focused_buffer(buffer) if buffer.dirty and cocoa_dialog( 'yesno-msgbox', { - title = 'Save?', - text = 'Save changes before closing?', - ['informative-text'] = 'You will have to save changes manually.', + title = locale.IO_CLOSE_TITLE, + text = locale.IO_CLOSE_TEXT, + ['informative-text'] = locale.IO_CLOSE_MSG, ['no-newline'] = true } ) ~= '2' then return false end buffer:delete() |