mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 09:28:21 +01:00
support locale at application level using package.json
This commit is contained in:
parent
d1496c6530
commit
d1e8fd91dc
@ -46,6 +46,7 @@ class BaseApplication extends this.OS.GUI.BaseModel
|
||||
when "#{@name}-about" then @openDialog "AboutDialog"
|
||||
when "#{@name}-exit" then @trigger "exit"
|
||||
@on "apptitlechange", () => @sysdock.update()
|
||||
@updateLocale @systemsetting.system.locale
|
||||
@loadScheme()
|
||||
|
||||
loadScheme: () ->
|
||||
@ -61,6 +62,13 @@ class BaseApplication extends this.OS.GUI.BaseModel
|
||||
return unless @keycomb[fnk]
|
||||
@keycomb[fnk][c] = f
|
||||
|
||||
updateLocale: (name) ->
|
||||
meta = @meta()
|
||||
return unless meta and meta.locales
|
||||
return unless meta.locales[name]
|
||||
for k, v of meta.locales[name]
|
||||
@_api.lang[k] = v
|
||||
|
||||
shortcut: (fnk, c, e) ->
|
||||
return true unless @keycomb[fnk]
|
||||
return true unless @keycomb[fnk][c]
|
||||
|
@ -190,7 +190,9 @@ Ant.OS.GUI =
|
||||
dock.get(0).newapp data
|
||||
app.sysdock = dock.get(0)
|
||||
app.appmenu = ($ "[data-id = 'appmenu']", "#syspanel")[0]
|
||||
app.subscribe "systemlocalechange", (name) -> app.update()
|
||||
app.subscribe "systemlocalechange", (name) ->
|
||||
app.updateLocale(name)
|
||||
app.update()
|
||||
app.subscribe "appregistry", ( m ) ->
|
||||
app.applySetting m.data.m if (m.name is app.name)
|
||||
|
||||
|
2
src/core/languages/gen.sh
Normal file → Executable file
2
src/core/languages/gen.sh
Normal file → Executable file
@ -20,7 +20,7 @@
|
||||
ord() {
|
||||
LC_CTYPE=C printf '%d' "'$1"
|
||||
}
|
||||
grep --include=\*.{coffee} -roh "$1" -e '__("[^"]*"' | while read -r line ; do
|
||||
grep --include=\*.coffee -roh "$1" -e '__("[^"]*"' | while read -r line ; do
|
||||
SUBSTRING=$(echo $line| cut -d'"' -f 2)
|
||||
if test -f "$2" && [ ! -z "$(grep -F "\"$SUBSTRING\":" "$2")" ]
|
||||
then
|
||||
|
@ -318,4 +318,79 @@
|
||||
"Welcome to AntOSDK":"Welcome to AntOSDK",
|
||||
"Your application version is older ({0} < {1})":"Your application version is older ({0} < {1})",
|
||||
"zip file generated in release folder":"zip file generated in release folder"
|
||||
|
||||
,
|
||||
"Cancels":"Cancels",
|
||||
"Command Palette":"Command Palette",
|
||||
"Mount Points":"Mount Points",
|
||||
"New CodePad extension at":"New CodePad extension at",
|
||||
"Report":"Report",
|
||||
"Select extension archive":"Select extension archive",
|
||||
"System error log":"System error log"
|
||||
|
||||
,
|
||||
"[^":"[^",
|
||||
"{0} is not a file":"{0} is not a file",
|
||||
"Action {0} is unsupported on: {1}":"Action {0} is unsupported on: {1}",
|
||||
"Application meta data isnt found":"Application meta data isnt found",
|
||||
"Cannot load extension meta data":"Cannot load extension meta data",
|
||||
"Cannot load scheme: {0}":"Cannot load scheme: {0}",
|
||||
"Cannot read folder: {0}":"Cannot read folder: {0}",
|
||||
"Change language mode":"Change language mode",
|
||||
"Change theme":"Change theme",
|
||||
"Command palete":"Command palete",
|
||||
"Command palette":"Command palette",
|
||||
"ct:Logout":"ct:Logout",
|
||||
"ct:Toggle fullscreen":"ct:Toggle fullscreen",
|
||||
"ct:User: {0}":"ct:User: {0}",
|
||||
"Current folder is not found":"Current folder is not found",
|
||||
"Error reported":"Error reported",
|
||||
"Error saving file {0}: {1}":"Error saving file {0}: {1}",
|
||||
"Example action":"Example action",
|
||||
"Extension installed":"Extension installed",
|
||||
"ExtensionName":"ExtensionName",
|
||||
"Fail to create: {0}":"Fail to create: {0}",
|
||||
"Fail to download: {0}":"Fail to download: {0}",
|
||||
"Fail to publish: {0}":"Fail to publish: {0}",
|
||||
"Fail to read: {0}":"Fail to read: {0}",
|
||||
"Fail to rename: {0}":"Fail to rename: {0}",
|
||||
"Fail to upload: {0}":"Fail to upload: {0}",
|
||||
"Install extension":"Install extension",
|
||||
"Invalid library: {0}":"Invalid library: {0}",
|
||||
"New Extension":"New Extension",
|
||||
"New project from current folder":"New project from current folder",
|
||||
"New Project":"New Project",
|
||||
"No meta-data found":"No meta-data found",
|
||||
"Open folder":"Open folder",
|
||||
"Open Folder":"Open Folder",
|
||||
"Package is generated in release folder":"Package is generated in release folder",
|
||||
"Please select a day":"Please select a day",
|
||||
"Please select an item":"Please select an item",
|
||||
"Please select color":"Please select color",
|
||||
"Start":"Start",
|
||||
"The folder is not empty: {0}":"The folder is not empty: {0}",
|
||||
"Unable to build extension":"Unable to build extension",
|
||||
"Unable to build project":"Unable to build project",
|
||||
"Unable to create archive":"Unable to create archive",
|
||||
"Unable to create extension directories":"Unable to create extension directories",
|
||||
"Unable to create extension template":"Unable to create extension template",
|
||||
"Unable to create package archive":"Unable to create package archive",
|
||||
"Unable to create project directory":"Unable to create project directory",
|
||||
"Unable to create template files":"Unable to create template files",
|
||||
"Unable to find action: {0}":"Unable to find action: {0}",
|
||||
"Unable to find extension: {0}":"Unable to find extension: {0}",
|
||||
"Unable to install extension":"Unable to install extension",
|
||||
"unable to load extension: {0}":"unable to load extension: {0}",
|
||||
"Unable to load libraries":"Unable to load libraries",
|
||||
"Unable to open: {0}":"Unable to open: {0}",
|
||||
"Unable to preload extension":"Unable to preload extension",
|
||||
"Unable to read: {0}":"Unable to read: {0}",
|
||||
"Unable to read meta-data":"Unable to read meta-data",
|
||||
"Unable to report error: {0}":"Unable to report error: {0}",
|
||||
"Unable to run extension":"Unable to run extension",
|
||||
"Unable to run project":"Unable to run project",
|
||||
"Unable to save file: {0}":"Unable to save file: {0}",
|
||||
"Value":"Value",
|
||||
"Verifying: {0}":"Verifying: {0}",
|
||||
"VFS unknown handle: {0}":"VFS unknown handle: {0}"
|
||||
}
|
||||
|
@ -267,4 +267,64 @@
|
||||
,
|
||||
"Graph editor":"Graph editor",
|
||||
"Render":"Render"
|
||||
|
||||
,
|
||||
"add {0} to zip":"add {0} to zip",
|
||||
"Add files to build target":"Add files to build target",
|
||||
"and unsaved project":"and unsaved project",
|
||||
"Build and Run":"Build and Run",
|
||||
"Build":"Build",
|
||||
"Build done":"Build done",
|
||||
"Build Options":"Build Options",
|
||||
"Build release":"Build release",
|
||||
"Cannot create file: {0}":"Cannot create file: {0}",
|
||||
"Cannot save project: {0}":"Cannot save project: {0}",
|
||||
"Cannot save the zip file {0} : {1}":"Cannot save the zip file {0} : {1}",
|
||||
"Coffees":"Coffees",
|
||||
"Compiled successful":"Compiled successful",
|
||||
"Copied {0} -> {1}":"Copied {0} -> {1}",
|
||||
"Copied files":"Copied files",
|
||||
"Created directory: {0}":"Created directory: {0}",
|
||||
"Created file: {0}":"Created file: {0}",
|
||||
"Css":"Css",
|
||||
"Error when create directory: {0}":"Error when create directory: {0}",
|
||||
"Generated {0}":"Generated {0}",
|
||||
"Hide":"Hide",
|
||||
"Ignore: {0} unsaved files {1}?":"Ignore: {0} unsaved files {1}?",
|
||||
"Ignore unsaved project ?":"Ignore unsaved project ?",
|
||||
"Installing...":"Installing...",
|
||||
"Javascripts":"Javascripts",
|
||||
"Metadata found...":"Metadata found...",
|
||||
"New Project at":"New Project at",
|
||||
"New project":"New project",
|
||||
"Opening {0}":"Opening {0}",
|
||||
"Open project":"Open project",
|
||||
"Open Project":"Open Project",
|
||||
"Output":"Output",
|
||||
"Please select {0} only":"Please select {0} only",
|
||||
"Please select a file/fofler":"Please select a file/fofler",
|
||||
"Preparing for release":"Preparing for release",
|
||||
"ProjectName":"ProjectName",
|
||||
"Project":"Project",
|
||||
"project saved":"project saved",
|
||||
"Running {0}...":"Running {0}...",
|
||||
"Select a file":"Select a file",
|
||||
"Show":"Show",
|
||||
"Uninstall: {0}?":"Uninstall: {0}?",
|
||||
"Unsaved project":"Unsaved project",
|
||||
"Update":"Update",
|
||||
"Verifying {0}":"Verifying {0}",
|
||||
"Version string is in invalid format: {0}":"Version string is in invalid format: {0}",
|
||||
"Welcome to AntOSDK":"Welcome to AntOSDK",
|
||||
"Your application version is older ({0} < {1})":"Your application version is older ({0} < {1})",
|
||||
"zip file generated in release folder":"zip file generated in release folder"
|
||||
|
||||
,
|
||||
"Cancels":"Cancels",
|
||||
"Command Palette":"Command Palette",
|
||||
"Mount Points":"Mount Points",
|
||||
"New CodePad extension at":"New CodePad extension at",
|
||||
"Report":"Report",
|
||||
"Select extension archive":"Select extension archive",
|
||||
"System error log":"System error log"
|
||||
}
|
||||
|
@ -9,5 +9,6 @@
|
||||
"version":"0.0.1-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-adn",
|
||||
"mimes":["none"]
|
||||
"mimes":["none"],
|
||||
"locale": {}
|
||||
}
|
@ -9,5 +9,7 @@
|
||||
"version":"0.0.2-a",
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-hdd-o",
|
||||
"mimes":["dir"]
|
||||
"mimes":["dir"],
|
||||
"locales": {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user