Add global locale change event, application now automatically change language when the event is triggered

This commit is contained in:
Xuan Sang LE
2018-03-10 12:22:01 +01:00
parent 45c89be5be
commit 1b9e6e88fa
38 changed files with 255 additions and 219 deletions

View File

@ -14,7 +14,7 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
app = _PM.appByPid item[0].value
app.quit() if app
header = [{width:50,value:__("Pid")},{value:__("Name")}, {value:__("Type"), width:80},{width:75,value:__("Alive (ms)")}]
header = [{width:50,value: "__(Pid)"},{value:"__(Name)"}, {value:"__(Type)", width:80},{width:75,value: "__(Alive (ms))"}]
@gdata =
processes:{}
alive:[]
@ -36,7 +36,7 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
{icon:if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon,
iconclass:if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
value:a.name},
{value: if _APP[a.name].type == 1 then __("Application") else __("Service")}
{value: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"}
{value: now - a.birth}
]
me.gdata.alive.push a.pid

View File

@ -60,7 +60,7 @@ class Blogger extends this.OS.GUI.BaseApplication
me.cvcatdb.save c, (r) ->
return me.error __("Cannot Edit category") if r.error
me.refreshCVCat()
me.refreshCVCat()
, __("Edit category"), { tree: (me.cvlist.get "data"), cat: cat }
(@find "cv-cat-del").set "onbtclick", (e) ->
@ -378,7 +378,6 @@ class Blogger extends this.OS.GUI.BaseApplication
]
@blogdb.find cond, (r) ->
return me.notify __("No post found: {0}", r.error) if r.error
console.log r.result
for v in r.result
v.text = v.title
v.complex = true

View File

@ -28,7 +28,7 @@
<textarea name="shortbiblio" input-class = "user-input"/>
<afx-hbox data-height = "35">
<div></div>
<afx-button iconclass = "fa fa-save" data-id = "bt-user-save" data-width="60" text = "Save"/>
<afx-button iconclass = "fa fa-save" data-id = "bt-user-save" data-width="60" text = "__(Save)"/>
</afx-hbox>
</afx-vbox>
</afx-hbox>

View File

@ -61,10 +61,10 @@ class CodeBlock extends this.OS.GUI.BaseApplication
menu = [{
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
}]

View File

@ -7,11 +7,11 @@ class UserService extends this.OS.GUI.BaseService
me = @
@child = [
{
text: __("About"), dataid: "user-about",
text: "__(About)", dataid: "user-about",
iconclass: "fa fa-user-circle-o"
},
{
text: __("Logout"), dataid: "sys-logout",
text: "__(Logout)", dataid: "sys-logout",
iconclass: "fa fa-user-times"
}
]

View File

@ -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

View File

@ -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
}]

View File

@ -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"
}

View File

@ -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
}]

View File

@ -96,17 +96,16 @@ 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
}]
menu
actionFile: (e) ->
console.log e
me = @
switch e
when "#{@name}-Open"