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

@ -6,7 +6,6 @@ NC=\033[0m
coffees= src/core/core.coffee\
src/core/api.coffee\
src/core/lang/generator.coffee\
src/core/settings.coffee\
src/core/handlers/RemoteHandler.coffee\
src/core/vfs.coffee\
@ -25,7 +24,7 @@ coffees= src/core/core.coffee\
packages = CoreServices NotePad wTerm ActivityMonitor Files MarkOn MarketPlace Blogger Preview
main: build_coffees build_tags build_themes schemes libs build_packages
main: build_coffees build_tags build_themes schemes libs build_packages languages
- cp src/index.html $(BUILDDIR)/
lite: build_coffee build_tag build_theme schemes build_packages
@ -58,10 +57,17 @@ testdata:
build_tags:
@echo "$(BLUE)Building tag files$(NC)"
-mkdir $(BUILDDIR)/resources
-mkdir $(BUILDDIR)/resources/languages
-rm $(BUILDDIR)/resources/antos_tags.js
for f in src/core/tags/*; do (cat "$${f}"; echo) >> $(BUILDDIR)/resources/antos_tags.js; done
languages:
-mkdir $(BUILDDIR)/resources
-mkdir $(BUILDDIR)/resources/languages
cp src/core/languages/*.json $(BUILDDIR)/resources/languages/
genlang:
read -r -p "Enter locale: " LOCAL;\
./src/core/languages/gen.sh ./src ./src/core/languages/$$LOCAL.json
build_themes: antos_themes_build

View File

@ -87,7 +87,7 @@ class PromptDialog extends BasicDialog
resizable: false,
buttons: [
{
label: __("0k"),
label: __("Ok"),
onclick: (d) ->
txt = (d.find "content1").value
return d.quit() if txt is ""

View File

@ -37,10 +37,9 @@ this.__ = () ->
args = arguments
return "Undefined" unless args.length > 0
d = args[0]
h = if typeof d is "string" then d.hash() else d
_API.lang[h] = d unless _API.lang[h]
return _API.lang[h] unless args.length > 1
return String.prototype.format.apply _API.lang[h], (args[i] for i in [1 .. args.length - 1])
_API.lang[d] = d unless _API.lang[d]
return _API.lang[d] unless args.length > 1
return String.prototype.format.apply _API.lang[d], (args[i] for i in [1 .. args.length - 1])
Date.prototype.toString = () ->
dd = @getDate()
@ -245,12 +244,13 @@ self.OS.API =
onsearch: (name, fn) ->
self.OS.API.searchHandler[name] = fn unless self.OS.API.searchHandler[name]
setLanguage: (name) ->
setLocale: (name) ->
path = "resources/languages/#{name}.json"
_API.get path, (d) ->
_OS.setting.user.language = name
_API.lang = d
, (e, s) ->
_OS.setting.user.language = "en_GB"
_courrier.oserror __("Language file {0} not found", path), e, s
, "json"

View File

@ -1,133 +0,0 @@
{
"182526600":"About",
"1728416751":"Logout",
"374360126":"This feature is not implemented yet",
"193429273":"New",
"2087881073":"Open",
"2087429796":"Save",
"2752946774":"Save as",
"193404632":"Pid",
"2087422178":"Name",
"2087427261":"Type",
"2843369965":"Alive (ms)",
"2535492479":"Application",
"3856720312":"Service",
"3424459089":"Cannot add new category",
"463938484":"Add category",
"363586160":"Cannot Edit category",
"2424497641":"Edit category",
"3805835340":"Delete category",
"2240681887":"Do you really want to delete: {0}?",
"3156273522":"Please select a category",
"4164367416":"Cannot save section: {0}",
"1192966569":"New section entry for {0}",
"2824455713":"Please select a section to move",
"1501625444":"Cannot move section",
"808187119":"Move to",
"300219980":"Please select a section to edit",
"135303592":"Modify section entry",
"1766808808":"Cannot export file for embeding to text",
"1217236556":"Select image file",
"1968305551":"Preview",
"4222677540":"Cannot fetch the entry content",
"912714953":"Cannot delete: {0}",
"3999757701":"Delete a post",
"3306560909":"Do you really want to delete this post ?",
"3727585409":"Cannot fetch user data",
"2639330688":"Full name must be entered",
"3465321180":"Cannot save user data",
"2286635345":"User data updated",
"2963875715":"Cannot fetch CV categories",
"2893553849":"Cannot delete all content of: {0} [{1}]",
"1900521681":"Cannot delete the category: {0} [{1}]",
"3357186118":"Section list is empty, please add one",
"3413006975":"Found {0} sections",
"1144919321":"Cannot delete the section: {0}",
"2644553141":"Delete section",
"3876829319":"Please insert a title in the text: beginning with heading",
"3245026722":"Please enter tags",
"1973052887":"Cannot save blog: {0}",
"2178779206":"No post found: {0}",
"3030608041":"Created: {0}",
"3030607100":"Updated: {0}",
"2531202798":"Please select a parent category",
"3588217300":"Please enter category name",
"4030690575":"Parent can not be the category itself",
"2422876246":"Title or content must not be blank",
"1873707161":"Cannot load 3rd library at: {0}",
"657074596":"Language file {0} not found",
"1322116428":"Applications",
"2087421738":"Home",
"2601558679":"Desktop",
"5862649":"OS",
"3390737312":"Google Drive",
"1121690732":"Shared",
"5861310":"0k",
"1434146403":"Cancel",
"2144977206":"Please select a date",
"193433354":"Yes",
"5861188":"No",
"5861313":"Ok",
"3689040132":"About: {0}",
"3772680544":"Resource not found: {0}",
"2523816740":"Please select a file",
"1865792728":"Only {0} could be selected",
"4229049240":"Dialog {0} not found",
"2838461131":"VDB Unknown condition for delete command",
"2960050010":"VFS unknown handler: {0}",
"1343590195":"VFS Cannot encode file: {0}",
"173279772":"VFS unknown action: {0}",
"4019955188":"{0} is not a directory",
"83405614":"Unknown API setting for {0}",
"3786481511":"User abort the authentication",
"4162337765":"Authentication",
"2930246978":"Would you like to login to {0}?",
"2202007582":"VFS cannot init {0}: {1}",
"2790700937":"VFS cannot get meta data for {0}",
"364661042":"VFS cannot save : {0}",
"3957553505":"VFS cannot read : {0}",
"4093931543":"VFS cannot create : {0}",
"4069871534":"VFS cannot write : {0}",
"2117555914":"VFS cannot delete : {0}",
"3287790145":"VFS cannot download file : {0}",
"894347874":"VFS cannot move : {0}",
"3486928966":"Fail to scan directory: {0}",
"3755150205":"Fail to create directory: {0}",
"3480594191":"Fail to publish file: {0}",
"2765007501":"Fail to get file meta data: {0}",
"3576800228":"Fail to read file: {0}",
"1708235907":"Fail to move file: {0} -> {1}",
"2173516457":"Fail to delete: {0}",
"3625310256":"Fail to {0} package",
"3500805390":"Fail to upload file to: {0}",
"166470768":"Fail to write to file: {0}",
"1533928590":"Cannot save system setting",
"4029431747":"Fail to make request: {0}",
"3283805977":"Fail to query data from database: {0}",
"2087960229":"Exit",
"2772420848":"Cannot read service script: {0}",
"2458026955":"Error find app by mimes {0}",
"1570757462":"Application {0} is not executable",
"1037620478":"No application available to open {0}",
"759608531":"Open with",
"1346677432":"Refresh",
"2941901658":"System fail: Cannot init desktop manager",
"3474507048":"Toggle Full screen",
"1205381487":"Log out",
"1949044628":"System fail: Cannot init login screen",
"4008767138":"Read more",
"566874284":"Kill process",
"165499909":"Title",
"3336612961":"Subtitle",
"69825113":"(Location)",
"2087699155":"From",
"4219309361":"Full name",
"2117088275":"Address",
"165407801":"Phone",
"173181097":"Email",
"193413550":"Url",
"2454725172":"Short biblio",
"3455523987":"Categories",
"2088336676":"Tags"
}

View File

@ -1,26 +0,0 @@
#!/bin/bash
ord() {
LC_CTYPE=C printf '%d' "'$1"
}
hash(){
text=$1
node -e "var hash, i, text;text='$1';hash = 5381;i = text.length;while (i) {hash = (hash * 33) ^ text.charCodeAt(--i);}; console.log(hash >>> 0)"
}
echo "{" > "tmp.json"
grep --include=\*.coffee -roh "$1" -e '__("[^"]*"' |while read -r line ; do
SUBSTRING=$(echo $line| cut -d'"' -f 2)
hs=$(hash "$SUBSTRING")
echo -e "\t\"$hs\":\"$SUBSTRING\"," >> "tmp.json"
done
grep --include=\*.html -roh './src/' -e '"__(.*)"' | while read -r line; do
SUBSTRING=${line:4:-2}
hs=$(hash "$SUBSTRING")
echo -e "\t\"$hs\":\"$SUBSTRING\"," >> "tmp.json"
done
echo "}" >> "tmp.json"
# remove duplicate entry
echo "remove duplicate line"
echo ""> $2
awk '!a[$0]++' "tmp.json" >> $2
rm tmp.json

View File

@ -0,0 +1,196 @@
{
"About":"About",
"About: {0}":"About: {0}",
"Add category":"Add category",
"Add repository":"Add repository",
"Address":"Address",
"Alive (ms)":"Alive (ms)",
"Application installed":"Application installed",
"Application {0} is not executable":"Application {0} is not executable",
"Application":"Application",
"Applications":"Applications",
"Authentication":"Authentication",
"Cancel":"Cancel",
"Cannot Edit category":"Cannot Edit category",
"Cannot add new category":"Cannot add new category",
"Cannot create {0}":"Cannot create {0}",
"Cannot delete all content of: {0} [{1}]":"Cannot delete all content of: {0} [{1}]",
"Cannot delete the category: {0} [{1}]":"Cannot delete the category: {0} [{1}]",
"Cannot delete the section: {0}":"Cannot delete the section: {0}",
"Cannot delete: {0}":"Cannot delete: {0}",
"Cannot down load the app {0}":"Cannot down load the app {0}",
"Cannot export file for embedding to text":"Cannot export file for embedding to text",
"Cannot fetch CV categories":"Cannot fetch CV categories",
"Cannot fetch the entry content":"Cannot fetch the entry content",
"Cannot fetch user data":"Cannot fetch user data",
"Cannot install {0}":"Cannot install {0}",
"Cannot load 3rd library at: {0}":"Cannot load 3rd library at: {0}",
"Cannot move section":"Cannot move section",
"Cannot read service script: {0}":"Cannot read service script: {0}",
"Cannot render the PDF file":"Cannot render the PDF file",
"Cannot save blog: {0}":"Cannot save blog: {0}",
"Cannot save section: {0}":"Cannot save section: {0}",
"Cannot save system setting":"Cannot save system setting",
"Cannot save user data":"Cannot save user data",
"Cannot share file: {0}":"Cannot share file: {0}",
"Cannot uninstall package: {0}":"Cannot uninstall package: {0}",
"Categories":"Categories",
"Clear all":"Clear all",
"Close tab":"Close tab",
"Close without saving ?":"Close without saving ?",
"Close":"Close",
"Copy not yet implemented":"Copy not yet implemented",
"Copy":"Copy",
"Created: {0}":"Created: {0}",
"Cut":"Cut",
"Delete a post":"Delete a post",
"Delete category":"Delete category",
"Delete section":"Delete section",
"Delete":"Delete",
"Desktop":"Desktop",
"Dialog {0} not found":"Dialog {0} not found",
"Do you really want to delete this post ?":"Do you really want to delete this post ?",
"Do you really want to delete: {0}?":"Do you really want to delete: {0}?",
"Download":"Download",
"Edit category":"Edit category",
"Edit repository":"Edit repository",
"Edit":"Edit",
"Email":"Email",
"Error find app by mimes {0}":"Error find app by mimes {0}",
"Error reading package meta data: {0}":"Error reading package meta data: {0}",
"Error saving file {0}":"Error saving file {0}",
"Exit":"Exit",
"Fail to create directory: {0}":"Fail to create directory: {0}",
"Fail to create {0}: {1}":"Fail to create {0}: {1}",
"Fail to delete {0}: {1}":"Fail to delete {0}: {1}",
"Fail to delete: {0}":"Fail to delete: {0}",
"Fail to fetch packages list from: {0}":"Fail to fetch packages list from: {0}",
"Fail to get file meta data: {0}":"Fail to get file meta data: {0}",
"Fail to make request: {0}":"Fail to make request: {0}",
"Fail to move file: {0} -> {1}":"Fail to move file: {0} -> {1}",
"Fail to paste: {0}":"Fail to paste: {0}",
"Fail to publish file: {0}":"Fail to publish file: {0}",
"Fail to query data from database: {0}":"Fail to query data from database: {0}",
"Fail to read file: {0}":"Fail to read file: {0}",
"Fail to rename to {0}: {1}":"Fail to rename to {0}: {1}",
"Fail to scan directory: {0}":"Fail to scan directory: {0}",
"Fail to upload file to: {0}":"Fail to upload file to: {0}",
"Fail to upload to {0}: {1}":"Fail to upload to {0}: {1}",
"Fail to write to file: {0}":"Fail to write to file: {0}",
"Fail to {0} package":"Fail to {0} package",
"File name":"File name",
"File not found {0}":"File not found {0}",
"File {0} copied":"File {0} copied",
"File {0} cut":"File {0} cut",
"File":"File",
"Folder name":"Folder name",
"Format : [name] url":"Format : [name] url",
"Found {0} sections":"Found {0} sections",
"From":"From",
"Full name must be entered":"Full name must be entered",
"Full name":"Full name",
"Google Drive":"Google Drive",
"Hidden files":"Hidden files",
"Home":"Home",
"Icon view":"Icon view",
"Ignore all {0} unsaved files ?":"Ignore all {0} unsaved files ?",
"Install":"Install",
"Invalid package: Meta data file not found":"Invalid package: Meta data file not found",
"Kill process":"Kill process",
"Language file {0} not found":"Language file {0} not found",
"Launch":"Launch",
"List view":"List view",
"Location":"Location",
"Log out":"Log out",
"Logout":"Logout",
"Mime type {0} is not supported":"Mime type {0} is not supported",
"Modify section entry":"Modify section entry",
"Move to":"Move to",
"Name":"Name",
"Navigation bar":"Navigation bar",
"New file":"New file",
"New folder":"New folder",
"New section entry for {0}":"New section entry for {0}",
"New":"New",
"No application available to open {0}":"No application available to open {0}",
"No post found: {0}":"No post found: {0}",
"No":"No",
"OS":"OS",
"Ok":"Ok",
"Only {0} could be selected":"Only {0} could be selected",
"Open file":"Open file",
"Open with":"Open with",
"Open":"Open",
"Options":"Options",
"Package uninstalled":"Package uninstalled",
"Parent can not be the category itself":"Parent can not be the category itself",
"Paste":"Paste",
"Phone":"Phone",
"Pid":"Pid",
"Please enter category name":"Please enter category name",
"Please enter tags":"Please enter tags",
"Please insert a title in the text: beginning with heading":"Please insert a title in the text: beginning with heading",
"Please select a category":"Please select a category",
"Please select a date":"Please select a date",
"Please select a file":"Please select a file",
"Please select a parent category":"Please select a parent category",
"Please select a section to edit":"Please select a section to edit",
"Please select a section to move":"Please select a section to move",
"Preview":"Preview",
"Properties":"Properties",
"Quit without saving ?":"Quit without saving ?",
"Quit":"Quit",
"Read more":"Read more",
"Refresh":"Refresh",
"Rename":"Rename",
"Repositories":"Repositories",
"Resource not found {0}":"Resource not found {0}",
"Resource not found: {0}":"Resource not found: {0}",
"Row {0}, col {1}, lines: {2}":"Row {0}, col {1}, lines: {2}",
"Save as":"Save as",
"Save":"Save",
"Section list is empty, please add one":"Section list is empty, please add one",
"Select image file":"Select image file",
"Service":"Service",
"Share file":"Share file",
"Shared url: {0}":"Shared url: {0}",
"Shared":"Shared",
"Short biblio":"Short biblio",
"Sidebar":"Sidebar",
"Subtitle":"Subtitle",
"System fail: Cannot init desktop manager":"System fail: Cannot init desktop manager",
"System fail: Cannot init login screen":"System fail: Cannot init login screen",
"Tags":"Tags",
"This feature is not implemented yet":"This feature is not implemented yet",
"Title or content must not be blank":"Title or content must not be blank",
"Title":"Title",
"Toggle Full screen":"Toggle Full screen",
"Tree view":"Tree view",
"Type":"Type",
"Uninstall : {0}?":"Uninstall : {0}?",
"Uninstall":"Uninstall",
"Unknown API setting for {0}":"Unknown API setting for {0}",
"Updated: {0}":"Updated: {0}",
"Upload":"Upload",
"Url":"Url",
"User abort the authentication":"User abort the authentication",
"User data updated":"User data updated",
"VDB Unknown condition for delete command":"VDB Unknown condition for delete command",
"VFS Cannot encode file: {0}":"VFS Cannot encode file: {0}",
"VFS cannot create : {0}":"VFS cannot create : {0}",
"VFS cannot delete : {0}":"VFS cannot delete : {0}",
"VFS cannot download file : {0}":"VFS cannot download file : {0}",
"VFS cannot get meta data for {0}":"VFS cannot get meta data for {0}",
"VFS cannot init {0}: {1}":"VFS cannot init {0}: {1}",
"VFS cannot move : {0}":"VFS cannot move : {0}",
"VFS cannot read : {0}":"VFS cannot read : {0}",
"VFS cannot save : {0}":"VFS cannot save : {0}",
"VFS cannot write : {0}":"VFS cannot write : {0}",
"VFS unknown action: {0}":"VFS unknown action: {0}",
"VFS unknown handler: {0}":"VFS unknown handler: {0}",
"View":"View",
"Would you like to login to {0}?":"Would you like to login to {0}?",
"Wrong format: it should be [name] url":"Wrong format: it should be [name] url",
"Yes":"Yes",
"{0} is not a directory":"{0} is not a directory"
}

View File

@ -0,0 +1,196 @@
{
"About":"About",
"About: {0}":"About: {0}",
"Add category":"Add category",
"Add repository":"Add repository",
"Address":"Address",
"Alive (ms)":"Alive (ms)",
"Application installed":"Application installed",
"Application {0} is not executable":"Application {0} is not executable",
"Application":"Application",
"Applications":"Applications",
"Authentication":"Authentication",
"Cancel":"Cancel",
"Cannot Edit category":"Cannot Edit category",
"Cannot add new category":"Cannot add new category",
"Cannot create {0}":"Cannot create {0}",
"Cannot delete all content of: {0} [{1}]":"Cannot delete all content of: {0} [{1}]",
"Cannot delete the category: {0} [{1}]":"Cannot delete the category: {0} [{1}]",
"Cannot delete the section: {0}":"Cannot delete the section: {0}",
"Cannot delete: {0}":"Cannot delete: {0}",
"Cannot down load the app {0}":"Cannot down load the app {0}",
"Cannot export file for embedding to text":"Cannot export file for embedding to text",
"Cannot fetch CV categories":"Cannot fetch CV categories",
"Cannot fetch the entry content":"Cannot fetch the entry content",
"Cannot fetch user data":"Cannot fetch user data",
"Cannot install {0}":"Cannot install {0}",
"Cannot load 3rd library at: {0}":"Cannot load 3rd library at: {0}",
"Cannot move section":"Cannot move section",
"Cannot read service script: {0}":"Cannot read service script: {0}",
"Cannot render the PDF file":"Cannot render the PDF file",
"Cannot save blog: {0}":"Cannot save blog: {0}",
"Cannot save section: {0}":"Cannot save section: {0}",
"Cannot save system setting":"Cannot save system setting",
"Cannot save user data":"Cannot save user data",
"Cannot share file: {0}":"Cannot share file: {0}",
"Cannot uninstall package: {0}":"Cannot uninstall package: {0}",
"Categories":"Categories",
"Clear all":"Clear all",
"Close tab":"Close tab",
"Close without saving ?":"Close without saving ?",
"Close":"Close",
"Copy not yet implemented":"Copy not yet implemented",
"Copy":"Copy",
"Created: {0}":"Created: {0}",
"Cut":"Cut",
"Delete a post":"Delete a post",
"Delete category":"Delete category",
"Delete section":"Delete section",
"Delete":"Delete",
"Desktop":"Desktop",
"Dialog {0} not found":"Dialog {0} not found",
"Do you really want to delete this post ?":"Do you really want to delete this post ?",
"Do you really want to delete: {0}?":"Do you really want to delete: {0}?",
"Download":"Download",
"Edit category":"Edit category",
"Edit repository":"Edit repository",
"Edit":"Edit",
"Email":"Email",
"Error find app by mimes {0}":"Error find app by mimes {0}",
"Error reading package meta data: {0}":"Error reading package meta data: {0}",
"Error saving file {0}":"Error saving file {0}",
"Exit":"Exit",
"Fail to create directory: {0}":"Fail to create directory: {0}",
"Fail to create {0}: {1}":"Fail to create {0}: {1}",
"Fail to delete {0}: {1}":"Fail to delete {0}: {1}",
"Fail to delete: {0}":"Fail to delete: {0}",
"Fail to fetch packages list from: {0}":"Fail to fetch packages list from: {0}",
"Fail to get file meta data: {0}":"Fail to get file meta data: {0}",
"Fail to make request: {0}":"Fail to make request: {0}",
"Fail to move file: {0} -> {1}":"Fail to move file: {0} -> {1}",
"Fail to paste: {0}":"Fail to paste: {0}",
"Fail to publish file: {0}":"Fail to publish file: {0}",
"Fail to query data from database: {0}":"Fail to query data from database: {0}",
"Fail to read file: {0}":"Fail to read file: {0}",
"Fail to rename to {0}: {1}":"Fail to rename to {0}: {1}",
"Fail to scan directory: {0}":"Fail to scan directory: {0}",
"Fail to upload file to: {0}":"Fail to upload file to: {0}",
"Fail to upload to {0}: {1}":"Fail to upload to {0}: {1}",
"Fail to write to file: {0}":"Fail to write to file: {0}",
"Fail to {0} package":"Fail to {0} package",
"File name":"File name",
"File not found {0}":"File not found {0}",
"File {0} copied":"File {0} copied",
"File {0} cut":"File {0} cut",
"File":"File",
"Folder name":"Folder name",
"Format : [name] url":"Format : [name] url",
"Found {0} sections":"Found {0} sections",
"From":"From",
"Full name must be entered":"Full name must be entered",
"Full name":"Full name",
"Google Drive":"Google Drive",
"Hidden files":"Hidden files",
"Home":"Home",
"Icon view":"Icon view",
"Ignore all {0} unsaved files ?":"Ignore all {0} unsaved files ?",
"Install":"Install",
"Invalid package: Meta data file not found":"Invalid package: Meta data file not found",
"Kill process":"Kill process",
"Language file {0} not found":"Language file {0} not found",
"Launch":"Launch",
"List view":"List view",
"Location":"Location",
"Log out":"Log out",
"Logout":"Logout",
"Mime type {0} is not supported":"Mime type {0} is not supported",
"Modify section entry":"Modify section entry",
"Move to":"Move to",
"Name":"Name",
"Navigation bar":"Navigation bar",
"New file":"New file",
"New folder":"New folder",
"New section entry for {0}":"New section entry for {0}",
"New":"New",
"No application available to open {0}":"No application available to open {0}",
"No post found: {0}":"No post found: {0}",
"No":"No",
"OS":"OS",
"Ok":"Ok",
"Only {0} could be selected":"Only {0} could be selected",
"Open file":"Open file",
"Open with":"Open with",
"Open":"Open",
"Options":"Options",
"Package uninstalled":"Package uninstalled",
"Parent can not be the category itself":"Parent can not be the category itself",
"Paste":"Paste",
"Phone":"Phone",
"Pid":"Pid",
"Please enter category name":"Please enter category name",
"Please enter tags":"Please enter tags",
"Please insert a title in the text: beginning with heading":"Please insert a title in the text: beginning with heading",
"Please select a category":"Please select a category",
"Please select a date":"Please select a date",
"Please select a file":"Please select a file",
"Please select a parent category":"Please select a parent category",
"Please select a section to edit":"Please select a section to edit",
"Please select a section to move":"Please select a section to move",
"Preview":"Preview",
"Properties":"Properties",
"Quit without saving ?":"Quit without saving ?",
"Quit":"Quit",
"Read more":"Read more",
"Refresh":"Refresh",
"Rename":"Rename",
"Repositories":"Repositories",
"Resource not found {0}":"Resource not found {0}",
"Resource not found: {0}":"Resource not found: {0}",
"Row {0}, col {1}, lines: {2}":"Row {0}, col {1}, lines: {2}",
"Save as":"Save as",
"Save":"Save",
"Section list is empty, please add one":"Section list is empty, please add one",
"Select image file":"Select image file",
"Service":"Service",
"Share file":"Share file",
"Shared url: {0}":"Shared url: {0}",
"Shared":"Shared",
"Short biblio":"Short biblio",
"Sidebar":"Sidebar",
"Subtitle":"Subtitle",
"System fail: Cannot init desktop manager":"System fail: Cannot init desktop manager",
"System fail: Cannot init login screen":"System fail: Cannot init login screen",
"Tags":"Tags",
"This feature is not implemented yet":"This feature is not implemented yet",
"Title or content must not be blank":"Title or content must not be blank",
"Title":"Title",
"Toggle Full screen":"Toggle Full screen",
"Tree view":"Tree view",
"Type":"Type",
"Uninstall : {0}?":"Uninstall : {0}?",
"Uninstall":"Uninstall",
"Unknown API setting for {0}":"Unknown API setting for {0}",
"Updated: {0}":"Updated: {0}",
"Upload":"Upload",
"Url":"Url",
"User abort the authentication":"User abort the authentication",
"User data updated":"User data updated",
"VDB Unknown condition for delete command":"VDB Unknown condition for delete command",
"VFS Cannot encode file: {0}":"VFS Cannot encode file: {0}",
"VFS cannot create : {0}":"VFS cannot create : {0}",
"VFS cannot delete : {0}":"VFS cannot delete : {0}",
"VFS cannot download file : {0}":"VFS cannot download file : {0}",
"VFS cannot get meta data for {0}":"VFS cannot get meta data for {0}",
"VFS cannot init {0}: {1}":"VFS cannot init {0}: {1}",
"VFS cannot move : {0}":"VFS cannot move : {0}",
"VFS cannot read : {0}":"VFS cannot read : {0}",
"VFS cannot save : {0}":"VFS cannot save : {0}",
"VFS cannot write : {0}":"VFS cannot write : {0}",
"VFS unknown action: {0}":"VFS unknown action: {0}",
"VFS unknown handler: {0}":"VFS unknown handler: {0}",
"View":"View",
"Would you like to login to {0}?":"Would you like to login to {0}?",
"Wrong format: it should be [name] url":"Wrong format: it should be [name] url",
"Yes":"Yes",
"{0} is not a directory":"{0} is not a directory"
}

24
src/core/languages/gen.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
ord() {
LC_CTYPE=C printf '%d' "'$1"
}
grep --include=\*.coffee -roh "$1" -e '__("[^"]*"' | while read -r line ; do
SUBSTRING=$(echo $line| cut -d'"' -f 2)
echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json"
done
grep --include=\*.{coffee,html} -roh "$1" -e '"__(.*)"' | while read -r line; do
len=$(( ${#line} - 6 ))
#echo $len
SUBSTRING=${line:4:len}
#echo $SUBSTRING
echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json"
done
sort tmp.json > tmp1.json
awk '!a[$0]++' "tmp1.json" > tmp.json
sed '$ s/.$//' tmp.json > tmp1.json
# remove duplicate entry
echo "remove duplicate line"
echo "{"> $2
cat tmp1.json >> $2
echo "}" >> $2
rm tmp.json tmp1.json

View File

@ -200,7 +200,7 @@
if(self.onfileselect)
self.onfileselect(e.data)
$(self.refs.stbar).empty()
$(self.refs.stbar).append($("<span>").append(__("Selected: {0} ({1} bytes)", e.data.filename, e.data.size)))//.html()
$(self.refs.stbar).append($("<span>").append(__("Selected: {0} ({1} bytes)", e.data.filename, e.data.size?e.data.size:"0")))//.html()
})
self.root.observable.on("filedbclick", function(e){
if(e.id != self.rid ) return

View File

@ -32,7 +32,7 @@
parse(text)
{
if(!text) return ""
match = text.match(/^__\(([^\)]*)\)$/)
match = text.toString().match(/^__\((.*)\)$/)
if(match)
{
return window.__(match[1])

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()