all packages now support localisation

This commit is contained in:
Xuan Sang LE
2018-03-10 01:05:34 +01:00
parent 9e0cd29030
commit d072566be8
19 changed files with 539 additions and 276 deletions

View File

@ -10,7 +10,7 @@
<input type = "text" name="subtitle" input-class = "user-input"/>
</afx-hbox>
<afx-hbox data-height = "30" >
<afx-label text = "__((Location))" data-width= "70"></afx-label>
<afx-label text = "__(Location)" data-width= "70"></afx-label>
<input type = "text" name="location" input-class = "user-input"/>
</afx-hbox>
<afx-hbox data-height = "30" >

View File

@ -145,7 +145,7 @@ class Blogger extends this.OS.GUI.BaseApplication
action: (e) ->
me.openDialog "FileDiaLog", (d, n, p) ->
p.asFileHandler().publish (r) ->
return me.error __("Cannot export file for embeding to text") if r.error
return me.error __("Cannot export file for embedding to text") if r.error
doc = me.editor.codemirror.getDoc()
doc.replaceSelection "![](#{me._api.handler.shared}/#{r.result})"
, __("Select image file"), { mimes: ["image/.*"] }

View File

@ -42,7 +42,7 @@ class Files extends this.OS.GUI.BaseApplication
return unless e.child
return if e.child.filename is "[..]"
e.child.path.asFileHandler().read (d) ->
return me.error "Resource not found #{e.child.path}" if d.error
return me.error __("Resource not found {0}", e.child.path) if d.error
f d.result
@view.set "onfileselect", (e) ->
@ -92,7 +92,7 @@ class Files extends this.OS.GUI.BaseApplication
dir = if p then p.asFileHandler() else me.currdir
dir.read (d) ->
if(d.error)
return me.error "Resource not found #{p}"
return me.error __("Resource not found {0}", p)
me.currdir = dir
if not dir.isRoot()
@ -110,28 +110,28 @@ class Files extends this.OS.GUI.BaseApplication
#console.log file
me = @
arr = {
text: "File",
text: __("File"),
child: [
{ text: "New file", dataid: "#{@name}-mkf", shortcut: 'C-F' },
{ text: "New folder", dataid: "#{@name}-mkdir", shortcut: 'C-D' },
{ text: "Open with", dataid: "#{@name}-open", child:@apps },
{ text: "Upload", dataid: "#{@name}-upload", shortcut: 'C-U' },
{ text: "Download", dataid: "#{@name}-download" },
{ text: "Share file", dataid: "#{@name}-share", shortcut: 'C-S' },
{ text: "Properties", dataid: "#{@name}-info", shortcut: 'C-I' }
{ text: __("New file"), dataid: "#{@name}-mkf", shortcut: 'C-F' },
{ text: __("New folder"), dataid: "#{@name}-mkdir", shortcut: 'C-D' },
{ text: __("Open with"), dataid: "#{@name}-open", child: @apps },
{ text: __("Upload"), dataid: "#{@name}-upload", shortcut: 'C-U' },
{ text: __("Download"), dataid: "#{@name}-download" },
{ text: __("Share file"), dataid: "#{@name}-share", shortcut: 'C-S' },
{ text: __("Properties"), dataid: "#{@name}-info", shortcut: 'C-I' }
], onmenuselect: (e) -> me.actionFile e.item.data.dataid
}
return arr
mnEdit: () ->
me = @
{
text: "Edit",
text: __("Edit"),
child: [
{ text: "Rename", dataid: "#{@name}-mv", shortcut: 'C-R' },
{ text: "Delete", dataid: "#{@name}-rm", shortcut: 'C-M' },
{ text: "Cut", dataid: "#{@name}-cut", shortcut: 'C-X' },
{ text: "Copy", dataid: "#{@name}-copy", shortcut: 'C-C' },
{ text: "Paste", dataid: "#{@name}-paste", shortcut: 'C-P' }
{ text: __("Rename"), dataid: "#{@name}-mv", shortcut: 'C-R' },
{ text: __("Delete"), dataid: "#{@name}-rm", shortcut: 'C-M' },
{ text: __("Cut"), dataid: "#{@name}-cut", shortcut: 'C-X' },
{ text: __("Copy"), dataid: "#{@name}-copy", shortcut: 'C-C' },
{ text: __("Paste"), dataid: "#{@name}-paste", shortcut: 'C-P' }
], onmenuselect: (e) -> me.actionEdit e.item.data.dataid
}
menu: () ->
@ -140,16 +140,16 @@ class Files extends this.OS.GUI.BaseApplication
@mnFile(),
@mnEdit(),
{
text: "View",
text: __("View"),
child: [
{ text: "Refresh", dataid: "#{@name}-refresh" },
{ text: "Sidebar", switch: true, checked: @setting.sidebar, dataid: "#{@name}-side" },
{ text: "Navigation bar", switch: true, checked: @setting.nav, dataid: "#{@name}-nav" },
{ text: "Hidden files", switch: true, checked: @setting.showhidden, dataid: "#{@name}-hidden" },
{ text: "Type", child: [
{ text: "Icon view", radio: true, checked: @setting.view is 'icon', dataid: "#{@name}-icon", type: 'icon' },
{ text: "List view", radio:true, checked: @setting.view is 'list' or not @setting.view, dataid: "#{@name}-list", type: 'list' },
{ text: "Tree view", radio:true, checked: @setting.view is 'tree', dataid: "#{@name}-tree", type: 'tree' }
{ text: __("Refresh"), dataid: "#{@name}-refresh" },
{ text: __("Sidebar"), switch: true, checked: @setting.sidebar, dataid: "#{@name}-side" },
{ text: __("Navigation bar"), switch: true, checked: @setting.nav, dataid: "#{@name}-nav" },
{ text: __("Hidden files"), switch: true, checked: @setting.showhidden, dataid: "#{@name}-hidden" },
{ text: __("Type"), child: [
{ text: __("Icon view"), radio: true, checked: @setting.view is 'icon', dataid: "#{@name}-icon", type: 'icon' },
{ text: __("List view"), radio:true, checked: @setting.view is 'list' or not @setting.view, dataid: "#{@name}-list", type: 'list' },
{ text: __("Tree view"), radio:true, checked: @setting.view is 'tree', dataid: "#{@name}-tree", type: 'tree' }
], onmenuselect: (e) ->
me.view.set 'view', e.item.data.type
me.setting.view = e.item.data.type
@ -171,12 +171,12 @@ class Files extends this.OS.GUI.BaseApplication
switch e.item.data.dataid
when "#{@name}-hidden"
#@.view.set "showhidden", e.item.data.checked
@registry "showhidden",e.item.data.checked
@registry "showhidden", e.item.data.checked
#@.setting.showhidden = e.item.data.checked
when "#{@name}-refresh"
@.chdir null
when "#{@name}-side"
@registry "sidebar",e.item.data.checked
@registry "sidebar", e.item.data.checked
#@setting.sidebar = e.item.data.checked
#@toggleSidebar e.item.data.checked
when "#{@name}-nav"
@ -195,8 +195,8 @@ class Files extends this.OS.GUI.BaseApplication
return if d is file.filename
file.path.asFileHandler()
.move "#{me.currdir.path}/#{d}", (r) ->
me.error "Fail to rename to #{d}: #{r.error}" if r.error
, "Rename", { label: "File name:", value: file.filename }
me.error __("Fail to rename to {0}: {1}", d, r.error) if r.error
, __("Rename"), { label: __("File name"), value: file.filename }
when "#{@name}-rm"
return unless file
@ -205,23 +205,23 @@ class Files extends this.OS.GUI.BaseApplication
return unless d
file.path.asFileHandler()
.remove (r) ->
me.error "Fail to delete #{file.filename}: #{r.error}" if r.error
, "Delete" ,
{ iconclass: "fa fa-question-circle", text: "Do you really want to delete: #{file.filename} ?" }
me.error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
, __("Delete") ,
{ iconclass: "fa fa-question-circle", text: __("Do you really want to delete: {0}?", file.filename) }
when "#{@name}-cut"
return unless file
@clipboard =
cut: true
file: file.path.asFileHandler()
@notify "File #{file.filename} cut"
@notify __("File {0} cut", file.filename)
when "#{@name}-copy"
return unless file
@clipboard =
cut: false
file: file.path.asFileHandler()
@notify "File #{file.filename} copied"
@notify __("File {0} copied", file.filename)
when "#{@name}-paste"
me = @
@ -230,9 +230,9 @@ class Files extends this.OS.GUI.BaseApplication
@clipboard.file # duplicate file check
.move "#{me.currdir.path}/#{@clipboard.file.basename}", (r) ->
me.clipboard = undefined
me.error "Fail to paste: #{r.error}" if r.error
me.error __("Fail to paste: {0}", r.error) if r.error
else
@notify "Copy not yet implemented"
@notify __("Copy not yet implemented")
@clipboard = undefined
else
@_api.handler.setting()
@ -246,16 +246,16 @@ class Files extends this.OS.GUI.BaseApplication
@openDialog "PromptDialog",
(d) ->
me.currdir.mk d, (r) ->
me.error "Fail to create #{d}: #{r.error}" if r.error
, "New folder", { label: "Folder name:" }
me.error __("Fail to create {0}: {1}", d, r.error) if r.error
, __("New folder"), { label: __("Folder name") }
when "#{@name}-mkf"
@openDialog "PromptDialog",
(d) ->
fp = "#{me.currdir.path}/#{d}".asFileHandler()
fp.write "text/plain", (r) ->
me.error "Fail to create #{d}: #{r.error}" if r.error
, "New file", { label: "File name:" }
me.error __("Fail to create {0}: {1}", d, r.error) if r.error
, __("New file"), { label: __("File name") }
when "#{@name}-info"
return unless file
@ -264,14 +264,14 @@ class Files extends this.OS.GUI.BaseApplication
when "#{@name}-upload"
me = @
@currdir.upload (r) ->
me.error "Faile to upload to: #{d}: #{r.error}" if r.error
me.error __("Fail to upload to {0}: {1}", d, r.error) if r.error
when "#{@name}-share"
me = @
return unless file and file.type is "file"
file.path.asFileHandler().publish (r) ->
return me.error "Cannot share file: #{r.error}" if r.error
return me.notify "Shared url: #{r.result}"
return me.error __("Cannot share file: {0}", r.error) if r.error
return me.notify __("Shared url: {0}", r.result)
when "#{@name}-download"
return unless file

View File

@ -74,7 +74,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
save: (file) ->
me = @
file.write (file.getb64 "text/plain"), (d) ->
return me.error "Error saving file #{file.basename}" if d.error
return me.error __("Error saving file {0}", file.basename) if d.error
file.dirty = false
file.text = file.basename
me.scheme.set "apptitle", "#{me.currfile.basename}"
@ -82,12 +82,12 @@ class MarkOn extends this.OS.GUI.BaseApplication
menu: () ->
me = @
menu = [{
text: "File",
text: __("File"),
child: [
{ text: "New", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: "Save", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: "Save as", dataid: "#{@name}-Saveas", shortcut: "A-W" }
{ text: __("New"), dataid: "#{@name}-New", shortcut: "A-N" },
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Save"), dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: __("Save as"), dataid: "#{@name}-Saveas", shortcut: "A-W" }
],
onmenuselect: (e) -> me.actionFile e.item.data.dataid
}]
@ -99,12 +99,12 @@ class MarkOn extends this.OS.GUI.BaseApplication
me.openDialog "FileDiaLog", (d, n) ->
me.currfile.setPath "#{d}/#{n}"
me.save me.currfile
, "Save as", { file: me.currfile }
, __("Save as"), { file: me.currfile }
switch e
when "#{@name}-Open"
@openDialog "FileDiaLog", ( d, f ) ->
me.open "#{d}/#{f}".asFileHandler()
, "Open file"
, __("Open file")
when "#{@name}-Save"
@currfile.cache = @editor.value()
return @save @currfile if @currfile.basename
@ -125,7 +125,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
if d
me.currfile.dirty = false
me.quit()
, "Quit", { text: "Quit without saving ?" }
, __("Quit"), { text: __("Quit without saving ?") }
MarkOn.dependencies = [ "mde/simplemde.min" ]

View File

@ -20,12 +20,12 @@ class RepositoryDialog extends this.OS.GUI.BaseDialog
sel.text = sel.name
sel.url = m[2]
me.refreshList()
, "Edit repository", { label: "Format : [name]url", value: "[#{e.data.text}] #{e.data.url}" }
, __("Edit repository"), { label: __("Format : [name] url"), value: "[#{e.data.text}] #{e.data.url}" }
(@find "btadd").set "onbtclick", (e) ->
me.openDialog "PromptDialog", (e) ->
m = e.match /\[([^\]]*)\]\s*(.*)/
return me.error "Wrong format: it should be [name] url" if not m or m.length isnt 3
return me.error __("Wrong format: it should be [name] url") if not m or m.length isnt 3
me.systemsetting.system.repositories.push {
name: m[1],
url: m[2],
@ -33,7 +33,7 @@ class RepositoryDialog extends this.OS.GUI.BaseDialog
i: me.systemsetting.system.repositories.length
}
me.refreshList()
, "Add repository", { label: "Format : [name]url" }
, __("Add repository"), { label: __("Format : [name] url") }
(@find "btdel").set "onbtclick", (e) ->
selidx = me.list.get "selidx"
return unless selidx >= 0
@ -54,14 +54,14 @@ class RepositoryDialog extends this.OS.GUI.BaseDialog
@parent.repo.set "items", @systemsetting.system.repositories
@parent.dialog = undefined if @parent
RepositoryDialog.scheme = """
<afx-app-window data-id = "repository-dialog-win" apptitle="Repositories" width="250" height="250">
<afx-app-window data-id = "repository-dialog-win" apptitle="__(Repositories)" width="250" height="250">
<afx-vbox >
<afx-list-view data-id="repo-list"></afx-list-view>
<afx-hbox data-height = "30">
<afx-button data-id = "btadd" text = "[+]" data-width="30"></afx-button>
<afx-button data-id = "btdel" text = "[-]" data-width="30"></afx-button>
<div></div>
<afx-button data-id = "btquit" text = "Cancel" data-width="50"></afx-button>
<afx-button data-id = "btquit" text = "__(Cancel)" data-width="50"></afx-button>
</afx-hbox>
</afx-vbox>
</afx-app-window>

View File

@ -43,7 +43,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
v.iconclass = "fa fa-adn"
me.applist.set "items", d
, (e, s) ->
me.error "Fail to fetch packages list from: #{url}"
me.error __("Fail to fetch packages list from: {0}", url)
appDetail: (d) ->
($ @container).css "visibility", "visible"
@ -67,8 +67,8 @@ class MarketPlace extends this.OS.GUI.BaseApplication
menu: () ->
me = @
return [
{ text: "Options", child: [
{ text: "Repositories", shortcut: "C-R" }
{ text: __("Options"), child: [
{ text: __("Repositories"), shortcut: "C-R" }
] , onmenuselect: (e) ->
me.openDialog "RepositoryDialog"
}
@ -90,7 +90,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
else
files.push name
idx = files.indexOf "package.json"
return me.error "Invalid package: Meta data file not found" if idx < 0
return me.error __("Invalid package: Meta data file not found") if idx < 0
# create all directory
me.mkdirs app.className, dir, () ->
me.installFile app.className, zip, files, () ->
@ -103,14 +103,14 @@ class MarketPlace extends this.OS.GUI.BaseApplication
v.iconclass = "fa fa-adn" unless v.iconclass or v.icon
v.path = pth
me.systemsetting.system.packages[app.className] = v
me.notify "Application installed"
me.notify __("Application installed")
me._gui.refreshSystemMenu()
me.appDetail app
.catch (err) ->
me.error "Error reading package meta data: " + err
me.error __("Error reading package meta data: {0}", err)
, (err, s) ->
return me.error "Cannot down load the app #{err}" if err
return me.error __("Cannot down load the app {0}", err) if err
uninstall: (e) ->
me = @
sel = @applist.get "selected"
@ -122,13 +122,13 @@ class MarketPlace extends this.OS.GUI.BaseApplication
(d) ->
return unless d
app.path.asFileHandler().remove (r) ->
return me.error "Cannot uninstall package: #{r.error}" if r.error
me.notify "Package uninstalled"
return me.error __("Cannot uninstall package: {0}", r.error) if r.error
me.notify __("Package uninstalled")
delete me.systemsetting.system.packages[name]
me._gui.refreshSystemMenu()
me.appDetail sel
, "Uninstall" ,
{ text: "Uninstall : #{app.name} ?" }
, __("Uninstall") ,
{ text: __("Uninstall : {0}?", app.name) }
mkdirs: (n, list, f) ->
me = @
if list.length is 0
@ -139,7 +139,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
dname = dir.basename
path.asFileHandler().mk dname, (r) ->
return me.mkdirs n, list, f if r.result
me.error "Cannot create #{path}/#{dir}"
me.error __("Cannot create {0}", "#{path}/#{dir}")
installFile: (n, zip, files, f) ->
me = @
@ -153,7 +153,7 @@ class MarketPlace extends this.OS.GUI.BaseApplication
fp.cache = new Blob [d], { type: "octet/stream" }
fp.write "text/plain", (r) ->
return me.installFile n, zip, files, f if r.result
me.error "Cannot install #{path}"
me.error __("Cannot install {0}", path)
MarketPlace.dependencies = [ "jszip.min" ]
MarketPlace.singleton = true

View File

@ -8,9 +8,9 @@
<afx-vbox data-id = "container">
<div data-id = "appname" data-height = "25"></div>
<afx-hbox data-height = "25">
<afx-button data-id = "bt-remove" text = "Uninstall" data-width = "65"></afx-button>
<afx-button data-id = "bt-exec" text = "Launch" data-width = "50"></afx-button>
<afx-button data-id = "bt-install" text = "Install" data-width = "50"></afx-button>
<afx-button data-id = "bt-remove" text = "__(Uninstall)" data-width = "65"></afx-button>
<afx-button data-id = "bt-exec" text = "__(Launch)" data-width = "50"></afx-button>
<afx-button data-id = "bt-install" text = "__(Install)" data-width = "50"></afx-button>
<div></div>
</afx-hbox>
<div>

View File

@ -58,7 +58,7 @@ class NotePad extends this.OS.GUI.BaseApplication
stup = (e) ->
c = me.editor.session.selection.getCursor()
l = me.editor.session.getLength()
$(stat).html "Row #{c.row}, col #{c.column}, lines: #{l}"
$(stat).html __("Row {0}, col {1}, lines: {2}", c.row, c.column, l)
stup(0)
@.editor.getSession().selection.on "changeCursor", (e) -> stup(e)
@editormux = false
@ -79,7 +79,7 @@ class NotePad extends this.OS.GUI.BaseApplication
return unless e.child
return if e.child.filename is "[..]"
e.child.path.asFileHandler().read (d) ->
return me.error "Resource not found #{e.child.path}" if d.error
return me.error __("Resource not found {0}", e.child.path) if d.error
f d.result
@fileview.set "onfileopen", (e) ->
return if e.type is "dir"
@ -101,7 +101,7 @@ class NotePad extends this.OS.GUI.BaseApplication
me.openDialog "YesNoDialog", (d) ->
return me.closeTab it if d
me.editor.focus()
, "Close tab", { text: "Close without saving ?" }
, __("Close tab"), { text: __("Close without saving ?") }
return false
#@tabarea.set "closable", true
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
@ -123,10 +123,10 @@ class NotePad extends this.OS.GUI.BaseApplication
contextMenu: () ->
[
{ text: "New file", dataid: "#{@name}-mkf" },
{ text: "New folder", dataid: "#{@name}-mkd" },
{ text: "Delete", dataid: "#{@name}-rm" }
{ text: "Refresh", dataid: "#{@name}-refresh" }
{ text: __("New file"), dataid: "#{@name}-mkf" },
{ text: __("New folder"), dataid: "#{@name}-mkd" },
{ text: __("Delete"), dataid: "#{@name}-rm" }
{ text: __("Refresh"), dataid: "#{@name}-refresh" }
]
contextAction: (e) ->
@ -140,16 +140,16 @@ class NotePad extends this.OS.GUI.BaseApplication
@openDialog "PromptDialog",
(d) ->
dir.mk d, (r) ->
me.error "Fail to create #{d}: #{r.error}" if r.error
, "New folder"
me.error __("Fail to create {0}: {1}", d, r.error) if r.error
, __("New folder")
when "#{@name}-mkf"
@openDialog "PromptDialog",
(d) ->
fp = "#{dir.path}/#{d}".asFileHandler()
fp.write "", (r) ->
me.error "Fail to create #{d}: #{r.error}" if r.error
, "New file"
me.error __("Fail to create {0}: {1}", d, r.error) if r.error
, __("New file")
when "#{@name}-rm"
return unless file
@openDialog "YesNoDialog",
@ -157,16 +157,16 @@ class NotePad extends this.OS.GUI.BaseApplication
return unless d
file.path.asFileHandler()
.remove (r) ->
me.error "Fail to delete #{file.filename}: #{r.error}" if r.error
, "Delete" ,
{ iconclass: "fa fa-question-circle", text: "Do you really want to delete: #{file.filename} ?" }
me.error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
, __("Delete") ,
{ iconclass: "fa fa-question-circle", text: __("Do you really want to delete: {0}?", file.filename) }
when "#{@name}-refresh"
@.chdir ( @fileview.get "path" )
save: (file) ->
me = @
file.write "text/plain", (d) ->
return me.error "Error saving file #{file.basename}" if d.error
return me.error __("Error saving file {0}", file.basename) if d.error
file.dirty = false
file.text = file.basename
me.tabarea.update()
@ -228,7 +228,7 @@ class NotePad extends this.OS.GUI.BaseApplication
dir = pth.asFileHandler()
dir.read (d) ->
if(d.error)
return me.error "Resource not found #{p}"
return me.error __("Resource not found {0}", p)
if not dir.isRoot()
p = dir.parent().asFileHandler()
p.filename = "[..]"
@ -242,12 +242,12 @@ class NotePad extends this.OS.GUI.BaseApplication
menu: () ->
me = @
menu = [{
text: "File",
text: __("File"),
child: [
{ text: "New", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: "Save", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: "Save as", dataid: "#{@name}-Saveas", shortcut: "A-W" }
{ text: __("New"), dataid: "#{@name}-New", shortcut: "A-N" },
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Save"), dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: __("Save as"), dataid: "#{@name}-Saveas", shortcut: "A-W" }
],
onmenuselect: (e) -> me.actionFile e.item.data.dataid
}]
@ -267,12 +267,12 @@ class NotePad extends this.OS.GUI.BaseApplication
me.tabarea.replaceItem me.currfile, file, false
me.currfile = file
me.save me.currfile
, "Save as", { file: me.currfile }
, __("Save as"), { file: me.currfile }
switch e
when "#{@name}-Open"
@openDialog "FileDiaLog", ( d, f ) ->
me.open "#{d}/#{f}".asFileHandler()
, "Open file"
, __("Open file")
when "#{@name}-Save"
@currfile.cache = @editor.getValue()
return @save @currfile if @currfile.basename
@ -292,7 +292,7 @@ class NotePad extends this.OS.GUI.BaseApplication
if d
v.dirty = false for v in dirties
me.quit()
, "Quit", { text: "Ignore all #{dirties.length} unsaved files ?" }
, __("Quit"), { text: __("Ignore all {0} unsaved files ?", dirties.length) }
NotePad.singleton = false
NotePad.dependencies = [

View File

@ -21,7 +21,7 @@ class Preview extends this.OS.GUI.BaseApplication
file.info.size = (file.info.size / 1024).toFixed(2)
me.renderFile file
, (err) ->
me.error "File not found #{file.path}"
me.error __("File not found {0}", file.path)
renderFile: (file) ->
mime = file.info.mime
@ -31,7 +31,7 @@ class Preview extends this.OS.GUI.BaseApplication
else if mime.match /image\/.*/g
@renderImage file
else
@notify "Mime type #{file.info.mime} is not support"
@notify __("Mime type {0} is not supported", file.info.mime)
setStatus: (t) ->
($ @status).html t
@ -68,7 +68,7 @@ class Preview extends this.OS.GUI.BaseApplication
fn(p+1)
fn(1)
.catch (err) ->
me.error "Cannot render the PDF file"
me.error __("Cannot render the PDF file")
me._api.loaded q, "FAIL"
, "binary"
@ -96,10 +96,10 @@ class Preview extends this.OS.GUI.BaseApplication
menu: () ->
me = @
menu = [{
text: "File",
text: __("File"),
child: [
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: "Close", dataid: "#{@name}-Close", shortcut: "C-X" },
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Close"), dataid: "#{@name}-Close", shortcut: "C-X" },
],
onmenuselect: (e) -> me.actionFile e.item.data.dataid
}]
@ -112,7 +112,7 @@ class Preview extends this.OS.GUI.BaseApplication
when "#{@name}-Open"
@openDialog "FileDiaLog", ( d, f ) ->
me.open "#{d}/#{f}".asFileHandler()
, "Open file", { mimes: me.meta().mimes }
, __("Open file"), { mimes: me.meta().mimes }
when "#{@name}-Close"
@quit()