mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-27 03:09:45 +02:00
all packages now support localisation
This commit is contained in:
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user