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

@ -1,5 +1,6 @@
class BaseModel class BaseModel
constructor: (@name, @args) -> constructor: (@name, @args) ->
me = @
@observable = riot.observable() @observable = riot.observable()
@_api = self.OS.API @_api = self.OS.API
@_gui = self.OS.GUI @_gui = self.OS.GUI
@ -8,7 +9,8 @@ class BaseModel
@on "exit", () -> me.quit() @on "exit", () -> me.quit()
@host = "#desktop" @host = "#desktop"
@dialog = undefined @dialog = undefined
@subscribe "systemlocalechange", () ->
me.scheme.update() if me.scheme
render: (p) -> render: (p) ->
_GUI.loadScheme p, @, @host _GUI.loadScheme p, @, @host

View File

@ -31,6 +31,11 @@ if not String.prototype.format
args = arguments args = arguments
return @replace /{(\d+)}/g, (match, number) -> return @replace /{(\d+)}/g, (match, number) ->
return if typeof args[number] != 'undefined' then args[number] else match return if typeof args[number] != 'undefined' then args[number] else match
String.prototype.__ = () ->
match = @match(/^__\((.*)\)$/)
return window.__(match[1]) if match
return @
# language directive # language directive
this.__ = () -> this.__ = () ->
_API = window.OS.API _API = window.OS.API
@ -244,14 +249,16 @@ self.OS.API =
onsearch: (name, fn) -> onsearch: (name, fn) ->
self.OS.API.searchHandler[name] = fn unless self.OS.API.searchHandler[name] self.OS.API.searchHandler[name] = fn unless self.OS.API.searchHandler[name]
setLocale: (name) -> setLocale: (name, f) ->
path = "resources/languages/#{name}.json" path = "resources/languages/#{name}.json"
_API.get path, (d) -> _API.get path, (d) ->
_OS.setting.user.language = name _OS.setting.system.locale = name
_API.lang = d _API.lang = d
if f then f() else _courrier.trigger "systemlocalechange"
, (e, s) -> , (e, s) ->
_OS.setting.user.language = "en_GB" #_OS.setting.system.locale = "en_GB"
_courrier.oserror __("Language file {0} not found", path), e, s _courrier.oserror __("Language file {0} not found", path), e, s
f() if f
, "json" , "json"
throwe: (n) -> throwe: (n) ->

View File

@ -9,7 +9,7 @@ self.OS.GUI =
META: {} META: {}
SYS_MENU: [ SYS_MENU: [
{ {
text: __("Applications"), text: "__(Applications)",
child: [], child: [],
dataid: "sys-apps" dataid: "sys-apps"
iconclass: "fa fa-adn", iconclass: "fa fa-adn",
@ -340,11 +340,11 @@ self.OS.GUI =
_GUI.SYS_MENU[0].child.push v for k, v of _OS.setting.system.packages when (v and v.app) _GUI.SYS_MENU[0].child.push v for k, v of _OS.setting.system.packages when (v and v.app)
_GUI.SYS_MENU.push v for k, v of _OS.setting.system.menu _GUI.SYS_MENU.push v for k, v of _OS.setting.system.menu
_GUI.SYS_MENU.push _GUI.SYS_MENU.push
text: __("Toggle Full screen"), text: "__(Toggle Full screen)",
dataid: "os-fullsize", dataid: "os-fullsize",
iconclass: "fa fa-tv" iconclass: "fa fa-tv"
_GUI.SYS_MENU.push _GUI.SYS_MENU.push
text: __("Log out"), text: "__(Log out)",
dataid: "sys-logout", dataid: "sys-logout",
iconclass: "fa fa-user-times" iconclass: "fa fa-user-times"
buildSystemMenu: () -> buildSystemMenu: () ->
@ -384,14 +384,18 @@ self.OS.GUI =
# clean up things # clean up things
_OS.cleanup() _OS.cleanup()
# get setting from conf # get setting from conf
_OS.systemSetting(conf) _OS.systemSetting conf
#console.log _OS.setting #console.log _OS.setting
# load theme # load theme
_GUI.loadTheme _OS.setting.appearance.theme _GUI.loadTheme _OS.setting.appearance.theme
# initDM # initDM
_GUI.initDM() _API.setLocale _OS.setting.system.locale, () ->
_GUI.initDM()
_courrier.observable.one "syspanelloaded", () -> _courrier.observable.one "syspanelloaded", () ->
# TODO load packages list then build system menu # TODO load packages list then build system menu
_courrier.observable.on "systemlocalechange", () ->
($ "#syspanel")[0].update()
_API.packages.cache (ret) -> _API.packages.cache (ret) ->
if ret.result if ret.result
_API.packages.fetch (r) -> _API.packages.fetch (r) ->

View File

@ -9,6 +9,8 @@
"Application {0} is not executable":"Application {0} is not executable", "Application {0} is not executable":"Application {0} is not executable",
"Application":"Application", "Application":"Application",
"Applications":"Applications", "Applications":"Applications",
"April":"April",
"August":"August",
"Authentication":"Authentication", "Authentication":"Authentication",
"Cancel":"Cancel", "Cancel":"Cancel",
"Cannot Edit category":"Cannot Edit category", "Cannot Edit category":"Cannot Edit category",
@ -43,6 +45,7 @@
"Copy":"Copy", "Copy":"Copy",
"Created: {0}":"Created: {0}", "Created: {0}":"Created: {0}",
"Cut":"Cut", "Cut":"Cut",
"December":"December",
"Delete a post":"Delete a post", "Delete a post":"Delete a post",
"Delete category":"Delete category", "Delete category":"Delete category",
"Delete section":"Delete section", "Delete section":"Delete section",
@ -78,6 +81,7 @@
"Fail to upload to {0}: {1}":"Fail to upload to {0}: {1}", "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 write to file: {0}":"Fail to write to file: {0}",
"Fail to {0} package":"Fail to {0} package", "Fail to {0} package":"Fail to {0} package",
"February":"February",
"File name":"File name", "File name":"File name",
"File not found {0}":"File not found {0}", "File not found {0}":"File not found {0}",
"File {0} copied":"File {0} copied", "File {0} copied":"File {0} copied",
@ -86,6 +90,7 @@
"Folder name":"Folder name", "Folder name":"Folder name",
"Format : [name] url":"Format : [name] url", "Format : [name] url":"Format : [name] url",
"Found {0} sections":"Found {0} sections", "Found {0} sections":"Found {0} sections",
"Fri":"Fri",
"From":"From", "From":"From",
"Full name must be entered":"Full name must be entered", "Full name must be entered":"Full name must be entered",
"Full name":"Full name", "Full name":"Full name",
@ -96,6 +101,9 @@
"Ignore all {0} unsaved files ?":"Ignore all {0} unsaved files ?", "Ignore all {0} unsaved files ?":"Ignore all {0} unsaved files ?",
"Install":"Install", "Install":"Install",
"Invalid package: Meta data file not found":"Invalid package: Meta data file not found", "Invalid package: Meta data file not found":"Invalid package: Meta data file not found",
"January":"January",
"July":"July",
"June":"June",
"Kill process":"Kill process", "Kill process":"Kill process",
"Language file {0} not found":"Language file {0} not found", "Language file {0} not found":"Language file {0} not found",
"Launch":"Launch", "Launch":"Launch",
@ -103,8 +111,11 @@
"Location":"Location", "Location":"Location",
"Log out":"Log out", "Log out":"Log out",
"Logout":"Logout", "Logout":"Logout",
"March":"March",
"May":"May",
"Mime type {0} is not supported":"Mime type {0} is not supported", "Mime type {0} is not supported":"Mime type {0} is not supported",
"Modify section entry":"Modify section entry", "Modify section entry":"Modify section entry",
"Mon":"Mon",
"Move to":"Move to", "Move to":"Move to",
"Name":"Name", "Name":"Name",
"Navigation bar":"Navigation bar", "Navigation bar":"Navigation bar",
@ -115,7 +126,9 @@
"No application available to open {0}":"No application available to open {0}", "No application available to open {0}":"No application available to open {0}",
"No post found: {0}":"No post found: {0}", "No post found: {0}":"No post found: {0}",
"No":"No", "No":"No",
"November":"November",
"OS":"OS", "OS":"OS",
"October":"October",
"Ok":"Ok", "Ok":"Ok",
"Only {0} could be selected":"Only {0} could be selected", "Only {0} could be selected":"Only {0} could be selected",
"Open file":"Open file", "Open file":"Open file",
@ -147,25 +160,32 @@
"Resource not found {0}":"Resource not found {0}", "Resource not found {0}":"Resource not found {0}",
"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}", "Row {0}, col {1}, lines: {2}":"Row {0}, col {1}, lines: {2}",
"Sat":"Sat",
"Save as":"Save as", "Save as":"Save as",
"Save":"Save", "Save":"Save",
"Section list is empty, please add one":"Section list is empty, please add one", "Section list is empty, please add one":"Section list is empty, please add one",
"Select image file":"Select image file", "Select image file":"Select image file",
"Selected: {0} ({1} bytes)":"Selected: {0} ({1} bytes)",
"September":"September",
"Service":"Service", "Service":"Service",
"Share file":"Share file", "Share file":"Share file",
"Shared url: {0}":"Shared url: {0}", "Shared url: {0}":"Shared url: {0}",
"Shared":"Shared", "Shared":"Shared",
"Short biblio":"Short biblio", "Short biblio":"Short biblio",
"Sidebar":"Sidebar", "Sidebar":"Sidebar",
"Size":"Size",
"Subtitle":"Subtitle", "Subtitle":"Subtitle",
"Sun":"Sun",
"System fail: Cannot init desktop manager":"System fail: Cannot init desktop manager", "System fail: Cannot init desktop manager":"System fail: Cannot init desktop manager",
"System fail: Cannot init login screen":"System fail: Cannot init login screen", "System fail: Cannot init login screen":"System fail: Cannot init login screen",
"Tags":"Tags", "Tags":"Tags",
"This feature is not implemented yet":"This feature is not implemented yet", "This feature is not implemented yet":"This feature is not implemented yet",
"Thu":"Thu",
"Title or content must not be blank":"Title or content must not be blank", "Title or content must not be blank":"Title or content must not be blank",
"Title":"Title", "Title":"Title",
"Toggle Full screen":"Toggle Full screen", "Toggle Full screen":"Toggle Full screen",
"Tree view":"Tree view", "Tree view":"Tree view",
"Tue":"Tue",
"Type":"Type", "Type":"Type",
"Uninstall : {0}?":"Uninstall : {0}?", "Uninstall : {0}?":"Uninstall : {0}?",
"Uninstall":"Uninstall", "Uninstall":"Uninstall",
@ -189,6 +209,7 @@
"VFS unknown action: {0}":"VFS unknown action: {0}", "VFS unknown action: {0}":"VFS unknown action: {0}",
"VFS unknown handler: {0}":"VFS unknown handler: {0}", "VFS unknown handler: {0}":"VFS unknown handler: {0}",
"View":"View", "View":"View",
"Wed":"Wed",
"Would you like to login to {0}?":"Would you like to login to {0}?", "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", "Wrong format: it should be [name] url":"Wrong format: it should be [name] url",
"Yes":"Yes", "Yes":"Yes",

View File

@ -2,7 +2,7 @@
ord() { ord() {
LC_CTYPE=C printf '%d' "'$1" LC_CTYPE=C printf '%d' "'$1"
} }
grep --include=\*.coffee -roh "$1" -e '__("[^"]*"' | while read -r line ; do grep --include=\*.{coffee,tag} -roh "$1" -e '__("[^"]*"' | while read -r line ; do
SUBSTRING=$(echo $line| cut -d'"' -f 2) SUBSTRING=$(echo $line| cut -d'"' -f 2)
echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json" echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json"
done done

View File

@ -43,154 +43,154 @@
"Copy":"Copy", "Copy":"Copy",
"Created: {0}":"Tạo: {0}", "Created: {0}":"Tạo: {0}",
"Cut":"Cắt", "Cut":"Cắt",
"Delete a post":"Delete a post", "Delete a post":"Xoá bài",
"Delete category":"Delete category", "Delete category":"Xoá danh mục",
"Delete section":"Delete section", "Delete section":"Xoá mục",
"Delete":"Delete", "Delete":"Xoá",
"Desktop":"Desktop", "Desktop":"Desktop",
"Dialog {0} not found":"Dialog {0} not found", "Dialog {0} not found":"Không tìm thấy hộp thoại {0}",
"Do you really want to delete this post ?":"Do you really want to delete this post ?", "Do you really want to delete this post ?":"Bạn muốn xoá bài này ?",
"Do you really want to delete: {0}?":"Do you really want to delete: {0}?", "Do you really want to delete: {0}?":"Bạn muốn xoá: {0}?",
"Download":"Download", "Download":"Tải về",
"Edit category":"Edit category", "Edit category":"Sửa danh mục",
"Edit repository":"Edit repository", "Edit repository":"Sửa kho ứng dụng",
"Edit":"Edit", "Edit":"Sửa",
"Email":"Email", "Email":"Email",
"Error find app by mimes {0}":"Error find app by mimes {0}", "Error find app by mimes {0}":"Lỗi khi tìm app bằng mime {0}",
"Error reading package meta data: {0}":"Error reading package meta data: {0}", "Error reading package meta data: {0}":"Lỗi khi đọc thông tin ứng dụng: {0}",
"Error saving file {0}":"Error saving file {0}", "Error saving file {0}":"Lỗi khi lưu file {0}",
"Exit":"Exit", "Exit":"Thoát",
"Fail to create directory: {0}":"Fail to create directory: {0}", "Fail to create directory: {0}":"Lỗi khi tạo folder: {0}",
"Fail to create {0}: {1}":"Fail to create {0}: {1}", "Fail to create {0}: {1}":"Lỗi khi tạo {0}: {1}",
"Fail to delete {0}: {1}":"Fail to delete {0}: {1}", "Fail to delete {0}: {1}":"Lỗi khi xoá {0}: {1}",
"Fail to delete: {0}":"Fail to delete: {0}", "Fail to delete: {0}":"Lỗi khi xoá: {0}",
"Fail to fetch packages list from: {0}":"Fail to fetch packages list from: {0}", "Fail to fetch packages list from: {0}":"Lỗi khi tải về danh sách ứng dụng từ: {0}",
"Fail to get file meta data: {0}":"Fail to get file meta data: {0}", "Fail to get file meta data: {0}":"Lỗi truy vấn thông tin file: {0}",
"Fail to make request: {0}":"Fail to make request: {0}", "Fail to make request: {0}":"Lỗi truy vấn: {0}",
"Fail to move file: {0} -> {1}":"Fail to move file: {0} -> {1}", "Fail to move file: {0} -> {1}":"Lỗi di chuyển file: {0} -> {1}",
"Fail to paste: {0}":"Fail to paste: {0}", "Fail to paste: {0}":"Lỗi khi dán: {0}",
"Fail to publish file: {0}":"Fail to publish file: {0}", "Fail to publish file: {0}":"Lỗi khi xuất bản file: {0}",
"Fail to query data from database: {0}":"Fail to query data from database: {0}", "Fail to query data from database: {0}":"Lỗi truy vấn cơ sở dữ liệu: {0}",
"Fail to read file: {0}":"Fail to read file: {0}", "Fail to read file: {0}":"Lỗi đọc file: {0}",
"Fail to rename to {0}: {1}":"Fail to rename to {0}: {1}", "Fail to rename to {0}: {1}":"Lỗi khi đổi tên file {0}: {1}",
"Fail to scan directory: {0}":"Fail to scan directory: {0}", "Fail to scan directory: {0}":"Lỗi khi quét thư mục: {0}",
"Fail to upload file to: {0}":"Fail to upload file to: {0}", "Fail to upload file to: {0}":"Lỗi khi tải file lên: {0}",
"Fail to upload to {0}: {1}":"Fail to upload to {0}: {1}", "Fail to upload to {0}: {1}":"Lỗi khi tải file lên {0}: {1}",
"Fail to write to file: {0}":"Fail to write to file: {0}", "Fail to write to file: {0}":"Lỗi khi ghi file: {0}",
"Fail to {0} package":"Fail to {0} package", "Fail to {0} package":"Lỗi {0} ứng dụng",
"File name":"File name", "File name":"Tên file",
"File not found {0}":"File not found {0}", "File not found {0}":"Không tìm thấy file {0}",
"File {0} copied":"File {0} copied", "File {0} copied":"Đã copy file {0}",
"File {0} cut":"File {0} cut", "File {0} cut":"Đã cắt file {0}",
"File":"File", "File":"File",
"Folder name":"Folder name", "Folder name":"Tên thư mục",
"Format : [name] url":"Format : [name] url", "Format : [name] url":"Định dạng : [name] url",
"Found {0} sections":"Found {0} sections", "Found {0} sections":"Tìm thấy {0} mục",
"From":"From", "From":"Từ",
"Full name must be entered":"Full name must be entered", "Full name must be entered":"Vui lòng điền họ và tên",
"Full name":"Full name", "Full name":"Họ và tên",
"Google Drive":"Google Drive", "Google Drive":"Google Drive",
"Hidden files":"Hidden files", "Hidden files":"File ẩn",
"Home":"Home", "Home":"Home",
"Icon view":"Icon view", "Icon view":"Xêm theo icon",
"Ignore all {0} unsaved files ?":"Ignore all {0} unsaved files ?", "Ignore all {0} unsaved files ?":"Bỏ qua {0} file chưa lưu ?",
"Install":"Install", "Install":"Cài đặt",
"Invalid package: Meta data file not found":"Invalid package: Meta data file not found", "Invalid package: Meta data file not found":"Ứng dụng không hợp lệ: không tìm thấy metadata",
"Kill process":"Kill process", "Kill process":"Đóng process",
"Language file {0} not found":"Language file {0} not found", "Language file {0} not found":"Không tìm thấy ngôn ngữ {0}",
"Launch":"Launch", "Launch":"Khởi chạy",
"List view":"List view", "List view":"Xem theo list",
"Location":"Location", "Location":"Vị trí",
"Log out":"Log out", "Log out":"Đăng xuất",
"Logout":"Logout", "Logout":"Đăng xuất",
"Mime type {0} is not supported":"Mime type {0} is not supported", "Mime type {0} is not supported":"Mime type {0} không được hổ trợ",
"Modify section entry":"Modify section entry", "Modify section entry":"Sửa mục",
"Move to":"Move to", "Move to":"Di chuyển vào",
"Name":"Name", "Name":"Tên",
"Navigation bar":"Navigation bar", "Navigation bar":"Thanh điều hướng",
"New file":"New file", "New file":"File mới",
"New folder":"New folder", "New folder":"Thư mục mới",
"New section entry for {0}":"New section entry for {0}", "New section entry for {0}":"Thêm mới mục trong {0}",
"New":"New", "New":"Tạo mới",
"No application available to open {0}":"No application available to open {0}", "No application available to open {0}":"Không tìm thấy ứng dụng dể đọc {0}",
"No post found: {0}":"No post found: {0}", "No post found: {0}":"Không tìm thấy bài: {0}",
"No":"No", "No":"Không",
"OS":"OS", "OS":"OS",
"Ok":"Ok", "Ok":"",
"Only {0} could be selected":"Only {0} could be selected", "Only {0} could be selected":"Chỉ file với mine {0} mới được chọn",
"Open file":"Open file", "Open file":"Mở file",
"Open with":"Open with", "Open with":"Mở với",
"Open":"Open", "Open":"Mở",
"Options":"Options", "Options":"Tuỳ chọn",
"Package uninstalled":"Package uninstalled", "Package uninstalled":"Đã gỡ bỏ ứng dụng",
"Parent can not be the category itself":"Parent can not be the category itself", "Parent can not be the category itself":"Danh mục cha không được trùng với danh mục hiện tại",
"Paste":"Paste", "Paste":"Dán",
"Phone":"Phone", "Phone":"Số điện thoại",
"Pid":"Pid", "Pid":"Pid",
"Please enter category name":"Please enter category name", "Please enter category name":"Vui lòng nhập tên danh mục",
"Please enter tags":"Please enter tags", "Please enter tags":"Vui lòng nhập tags",
"Please insert a title in the text: beginning with heading":"Please insert a title in the text: beginning with heading", "Please insert a title in the text: beginning with heading":"Vuil lòng nhập tiêu đề: bắt đầu bài bằng heading",
"Please select a category":"Please select a category", "Please select a category":"Vui lòng chọn danh mục",
"Please select a date":"Please select a date", "Please select a date":"Vui lòng chọn ngày",
"Please select a file":"Please select a file", "Please select a file":"Vui lòng chọn file",
"Please select a parent category":"Please select a parent category", "Please select a parent category":"Vui lòng chọn danh much cha",
"Please select a section to edit":"Please select a section to edit", "Please select a section to edit":"Vui lòng chọn mục để sửa",
"Please select a section to move":"Please select a section to move", "Please select a section to move":"Vuil lòng chọn mục để di chuyển",
"Preview":"Preview", "Preview":"Preview",
"Properties":"Properties", "Properties":"Thông tin",
"Quit without saving ?":"Quit without saving ?", "Quit without saving ?":"Thoát mà không lưu ?",
"Quit":"Quit", "Quit":"Thoát",
"Read more":"Read more", "Read more":"Đọc thêm",
"Refresh":"Refresh", "Refresh":"Làm mới",
"Rename":"Rename", "Rename":"Đổi tên",
"Repositories":"Repositories", "Repositories":"Các kho ứng dụng",
"Resource not found {0}":"Resource not found {0}", "Resource not found {0}":"Không tìm thấy tài nguyên {0}",
"Resource not found: {0}":"Resource not found: {0}", "Resource not found: {0}":"Không tìm thấy tài nguyên: {0}",
"Row {0}, col {1}, lines: {2}":"Row {0}, col {1}, lines: {2}", "Row {0}, col {1}, lines: {2}":"Hàng {0}, cột {1}, dòng: {2}",
"Save as":"Save as", "Save as":"Lưu như",
"Save":"Save", "Save":"Lưu",
"Section list is empty, please add one":"Section list is empty, please add one", "Section list is empty, please add one":"Danh sách mục rỗng, vui lòng tạo mới",
"Select image file":"Select image file", "Select image file":"Chọn file ảnh",
"Service":"Service", "Service":"Dịch vụ",
"Share file":"Share file", "Share file":"Chia sẻ",
"Shared url: {0}":"Shared url: {0}", "Shared url: {0}":"Liên kết chia sẻ: {0}",
"Shared":"Shared", "Shared":"Đã chia sẻ",
"Short biblio":"Short biblio", "Short biblio":"Tiểu sử ngắn",
"Sidebar":"Sidebar", "Sidebar":"Sidebar",
"Subtitle":"Subtitle", "Subtitle":"Tiêu đề con",
"System fail: Cannot init desktop manager":"System fail: Cannot init desktop manager", "System fail: Cannot init desktop manager":"Lỗi hệ thống: không thể khởi chạy trình quản lý desktop",
"System fail: Cannot init login screen":"System fail: Cannot init login screen", "System fail: Cannot init login screen":"Lỗi hệ thống: không thể khởi chạy màn hình đăng nhập",
"Tags":"Tags", "Tags":"Tags",
"This feature is not implemented yet":"This feature is not implemented yet", "This feature is not implemented yet":"Chức năng này chưa được cài đặt",
"Title or content must not be blank":"Title or content must not be blank", "Title or content must not be blank":"Tiêu đề hoặc nội dụng không được để trống",
"Title":"Title", "Title":"Tiêu đề",
"Toggle Full screen":"Toggle Full screen", "Toggle Full screen":"Bật/tắt toàn màn hình",
"Tree view":"Tree view", "Tree view":"Xem theo cây",
"Type":"Type", "Type":"Loại",
"Uninstall : {0}?":"Uninstall : {0}?", "Uninstall : {0}?":"Gỡ cài đặt : {0}?",
"Uninstall":"Uninstall", "Uninstall":"Gỡ cài đặt",
"Unknown API setting for {0}":"Unknown API setting for {0}", "Unknown API setting for {0}":"Không tìm thấy cài đặt API của {0}",
"Updated: {0}":"Updated: {0}", "Updated: {0}":"Đã cập nhật: {0}",
"Upload":"Upload", "Upload":"Tải lên",
"Url":"Url", "Url":"Url",
"User abort the authentication":"User abort the authentication", "User abort the authentication":"Người dùng huỷ xác thực",
"User data updated":"User data updated", "User data updated":"Thông tin người dùng đã được cập nhật",
"VDB Unknown condition for delete command":"VDB Unknown condition for delete command", "VDB Unknown condition for delete command":"VDB không rõ điều kiện cho lệnh xoá",
"VFS Cannot encode file: {0}":"VFS Cannot encode file: {0}", "VFS Cannot encode file: {0}":"VFS Không thể mã hoá file: {0}",
"VFS cannot create : {0}":"VFS cannot create : {0}", "VFS cannot create : {0}":"VFS không thể tạo : {0}",
"VFS cannot delete : {0}":"VFS cannot delete : {0}", "VFS cannot delete : {0}":"VFS không thể xoá : {0}",
"VFS cannot download file : {0}":"VFS cannot download file : {0}", "VFS cannot download file : {0}":"VFS không thể tải về : {0}",
"VFS cannot get meta data for {0}":"VFS cannot get meta data for {0}", "VFS cannot get meta data for {0}":"VFS không thể truy vấn thông tin của {0}",
"VFS cannot init {0}: {1}":"VFS cannot init {0}: {1}", "VFS cannot init {0}: {1}":"VFS không thể khởi động {0}: {1}",
"VFS cannot move : {0}":"VFS cannot move : {0}", "VFS cannot move : {0}":"VFS không thể di chuyển : {0}",
"VFS cannot read : {0}":"VFS cannot read : {0}", "VFS cannot read : {0}":"VFS không thể đọc : {0}",
"VFS cannot save : {0}":"VFS cannot save : {0}", "VFS cannot save : {0}":"VFS không thể lưu : {0}",
"VFS cannot write : {0}":"VFS cannot write : {0}", "VFS cannot write : {0}":"VFS không thể viết : {0}",
"VFS unknown action: {0}":"VFS unknown action: {0}", "VFS unknown action: {0}":"VFS không rõ hành động : {0}",
"VFS unknown handler: {0}":"VFS unknown handler: {0}", "VFS unknown handler: {0}":"VFS không rõ trình xữ lý: {0}",
"View":"View", "View":"Xem",
"Would you like to login to {0}?":"Would you like to login to {0}?", "Would you like to login to {0}?":"Bạn có muốn đăng nhập vào {0}?",
"Wrong format: it should be [name] url":"Wrong format: it should be [name] url", "Wrong format: it should be [name] url":"Sai định dạng: định dạng hợp lệ [name] url",
"Yes":"Yes", "Yes":"",
"{0} is not a directory":"{0} is not a directory" "{0} is not a directory":"{0} không phải là thư mục"
} }

View File

@ -3,7 +3,6 @@
_OS.setting.applications = conf.applications if conf.applications _OS.setting.applications = conf.applications if conf.applications
_OS.setting.appearance = conf.appearance if conf.appearance _OS.setting.appearance = conf.appearance if conf.appearance
_OS.setting.user = conf.user _OS.setting.user = conf.user
_OS.setting.user.language = "en_GB" unless conf.user.language
_OS.setting.VFS = conf.VFS if conf.VFS _OS.setting.VFS = conf.VFS if conf.VFS
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path _OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
_OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu _OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu
@ -32,6 +31,7 @@
user: "home:///.packages", user: "home:///.packages",
system: "os:///packages" system: "os:///packages"
} unless _OS.setting.system.pkgpaths } unless _OS.setting.system.pkgpaths
_OS.setting.system.locale = "en_GB" unless _OS.setting.system.locale
_OS.setting.system.menu = {} unless _OS.setting.system.menu _OS.setting.system.menu = {} unless _OS.setting.system.menu
_OS.setting.system.repositories = [] unless _OS.setting.system.repositories _OS.setting.system.repositories = [] unless _OS.setting.system.repositories
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme _OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
@ -45,7 +45,7 @@
} unless _OS.setting.VFS.gdrive } unless _OS.setting.VFS.gdrive
#search for app #search for app
_API.onsearch __("Applications"), (t) -> _API.onsearch "__(Applications)", (t) ->
ar = [] ar = []
term = new RegExp t, "i" term = new RegExp t, "i"
for k, v of _OS.setting.system.packages when v.app for k, v of _OS.setting.system.packages when v.app

View File

@ -4,7 +4,7 @@
<li class = "afx-window-close" onclick = {close}></li> <li class = "afx-window-close" onclick = {close}></li>
<li if = {minimizable == true} class = "afx-window-minimize" onclick = {minimize}></li> <li if = {minimizable == true} class = "afx-window-minimize" onclick = {minimize}></li>
<li if = {resizable == true} class = "afx-window-maximize" onclick={maximize}></li> <li if = {resizable == true} class = "afx-window-maximize" onclick={maximize}></li>
<li ref = "dragger" class = "afx-window-title">{ apptitle }</li> <li ref = "dragger" class = "afx-window-title">{ apptitle?apptitle.toString().__():apptitle }</li>
</ul> </ul>
<div class = "afx-clear"></div> <div class = "afx-clear"></div>
<div ref = "content" class = "afx-window-content"> <div ref = "content" class = "afx-window-content">
@ -49,6 +49,10 @@
{ {
return self[k] return self[k]
} }
self.root.update = function()
{
self.update()
}
minimize() minimize()
{ {
this.root.observable.trigger("hide") this.root.observable.trigger("hide")

View File

@ -62,7 +62,7 @@
self.year = date.getFullYear() self.year = date.getFullYear()
var now ={ d:(new Date()).getDate(), m:(new Date()).getMonth(), y:(new Date()).getFullYear()} var now ={ d:(new Date()).getDate(), m:(new Date()).getMonth(), y:(new Date()).getFullYear()}
months = [__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'), __('September'), __('October'), __('November'), __('December')] months = [__("January"), __("February"), __("March"), __("April"), __("May"), __("June"), __("July"), __("August"), __("September"), __("October"), __("November"), __("December")]
this_month = new Date(self.year, self.month, 1) this_month = new Date(self.year, self.month, 1)
next_month = new Date(self.year, self.month + 1, 1) next_month = new Date(self.year, self.month + 1, 1)

View File

@ -1,3 +0,0 @@
<afx-dummy>
<yield/>
</afx-dummy>

View File

@ -0,0 +1,10 @@
<afx-dummy>
<yield/>
<script>
var self = this
self.root.update = function()
{
self.update()
}
</script>
</afx-dummy>

View File

@ -2,7 +2,7 @@
<span style = {color?"color:" + color:""} > <span style = {color?"color:" + color:""} >
<i if={iconclass} class = {iconclass} ></i> <i if={iconclass} class = {iconclass} ></i>
<i if={icon} class="icon-style" style = { "background: url("+icon+");background-size: 100% 100%;background-repeat: no-repeat;" }></i> <i if={icon} class="icon-style" style = { "background: url("+icon+");background-size: 100% 100%;background-repeat: no-repeat;" }></i>
{ parse(text) } { text?text.toString().__():"" }
</span> </span>
<script> <script>
this.iconclass = opts.iconclass this.iconclass = opts.iconclass
@ -29,16 +29,5 @@
{ {
return self[k] return self[k]
} }
parse(text)
{
if(!text) return ""
match = text.toString().match(/^__\((.*)\)$/)
if(match)
{
return window.__(match[1])
}
else
return text
}
</script> </script>
</afx-label> </afx-label>

View File

@ -39,6 +39,10 @@
{ {
return self[k] return self[k]
} }
self.root.update = function()
{
self.update()
}
this.on('mount', function() { this.on('mount', function() {
//console.log(self.refs.aOsmenu.root) //console.log(self.refs.aOsmenu.root)
$(self.refs.aOsmenu.root).css("z-index",1000000) $(self.refs.aOsmenu.root).css("z-index",1000000)

View File

@ -14,7 +14,7 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
app = _PM.appByPid item[0].value app = _PM.appByPid item[0].value
app.quit() if app 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 = @gdata =
processes:{} processes:{}
alive:[] 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, {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, iconclass:if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
value:a.name}, 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} {value: now - a.birth}
] ]
me.gdata.alive.push a.pid me.gdata.alive.push a.pid

View File

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

View File

@ -28,7 +28,7 @@
<textarea name="shortbiblio" input-class = "user-input"/> <textarea name="shortbiblio" input-class = "user-input"/>
<afx-hbox data-height = "35"> <afx-hbox data-height = "35">
<div></div> <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-hbox>
</afx-vbox> </afx-vbox>
</afx-hbox> </afx-hbox>

View File

@ -61,10 +61,10 @@ class CodeBlock extends this.OS.GUI.BaseApplication
menu = [{ menu = [{
text: "File", text: "File",
child: [ child: [
{ text: __("New"), dataid: "#{@name}-New", shortcut: "A-N" }, { text: "__(New)", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" }, { text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Save"), dataid: "#{@name}-Save", shortcut: "C-S" }, { text: "__(Save)", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: __("Save as"), dataid: "#{@name}-Saveas", shortcut: "A-W" } { text: "__(Save as)", dataid: "#{@name}-Saveas", shortcut: "A-W" }
], ],
onmenuselect: (e) -> me.actionFile e.item.data.dataid onmenuselect: (e) -> me.actionFile e.item.data.dataid
}] }]

View File

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

View File

@ -110,28 +110,28 @@ class Files extends this.OS.GUI.BaseApplication
#console.log file #console.log file
me = @ me = @
arr = { arr = {
text: __("File"), text: "__(File)",
child: [ child: [
{ text: __("New file"), dataid: "#{@name}-mkf", shortcut: 'C-F' }, { text: "__(New file)", dataid: "#{@name}-mkf", shortcut: 'C-F' },
{ text: __("New folder"), dataid: "#{@name}-mkdir", shortcut: 'C-D' }, { text: "__(New folder)", dataid: "#{@name}-mkdir", shortcut: 'C-D' },
{ text: __("Open with"), dataid: "#{@name}-open", child: @apps }, { text: "__(Open with)", dataid: "#{@name}-open", child: @apps },
{ text: __("Upload"), dataid: "#{@name}-upload", shortcut: 'C-U' }, { text: "__(Upload)", dataid: "#{@name}-upload", shortcut: 'C-U' },
{ text: __("Download"), dataid: "#{@name}-download" }, { text: "__(Download)", dataid: "#{@name}-download" },
{ text: __("Share file"), dataid: "#{@name}-share", shortcut: 'C-S' }, { text: "__(Share file)", dataid: "#{@name}-share", shortcut: 'C-S' },
{ text: __("Properties"), dataid: "#{@name}-info", shortcut: 'C-I' } { text: "__(Properties)", dataid: "#{@name}-info", shortcut: 'C-I' }
], onmenuselect: (e) -> me.actionFile e.item.data.dataid ], onmenuselect: (e) -> me.actionFile e.item.data.dataid
} }
return arr return arr
mnEdit: () -> mnEdit: () ->
me = @ me = @
{ {
text: __("Edit"), text: "__(Edit)",
child: [ child: [
{ text: __("Rename"), dataid: "#{@name}-mv", shortcut: 'C-R' }, { text: "__(Rename)", dataid: "#{@name}-mv", shortcut: 'C-R' },
{ text: __("Delete"), dataid: "#{@name}-rm", shortcut: 'C-M' }, { text: "__(Delete)", dataid: "#{@name}-rm", shortcut: 'C-M' },
{ text: __("Cut"), dataid: "#{@name}-cut", shortcut: 'C-X' }, { text: "__(Cut)", dataid: "#{@name}-cut", shortcut: 'C-X' },
{ text: __("Copy"), dataid: "#{@name}-copy", shortcut: 'C-C' }, { text: "__(Copy)", dataid: "#{@name}-copy", shortcut: 'C-C' },
{ text: __("Paste"), dataid: "#{@name}-paste", shortcut: 'C-P' } { text: "__(Paste)", dataid: "#{@name}-paste", shortcut: 'C-P' }
], onmenuselect: (e) -> me.actionEdit e.item.data.dataid ], onmenuselect: (e) -> me.actionEdit e.item.data.dataid
} }
menu: () -> menu: () ->
@ -140,16 +140,16 @@ class Files extends this.OS.GUI.BaseApplication
@mnFile(), @mnFile(),
@mnEdit(), @mnEdit(),
{ {
text: __("View"), text: "__(View)",
child: [ child: [
{ text: __("Refresh"), dataid: "#{@name}-refresh" }, { text: "__(Refresh)", dataid: "#{@name}-refresh" },
{ text: __("Sidebar"), switch: true, checked: @setting.sidebar, dataid: "#{@name}-side" }, { text: "__(Sidebar)", switch: true, checked: @setting.sidebar, dataid: "#{@name}-side" },
{ text: __("Navigation bar"), switch: true, checked: @setting.nav, dataid: "#{@name}-nav" }, { text: "__(Navigation bar)", switch: true, checked: @setting.nav, dataid: "#{@name}-nav" },
{ text: __("Hidden files"), switch: true, checked: @setting.showhidden, dataid: "#{@name}-hidden" }, { text: "__(Hidden files)", switch: true, checked: @setting.showhidden, dataid: "#{@name}-hidden" },
{ text: __("Type"), child: [ { text: "__(Type)", child: [
{ text: __("Icon view"), radio: true, checked: @setting.view is 'icon', dataid: "#{@name}-icon", type: 'icon' }, { 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: "__(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: "__(Tree view)", radio:true, checked: @setting.view is 'tree', dataid: "#{@name}-tree", type: 'tree' }
], onmenuselect: (e) -> ], onmenuselect: (e) ->
me.view.set 'view', e.item.data.type me.view.set 'view', e.item.data.type
me.setting.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: () -> menu: () ->
me = @ me = @
menu = [{ menu = [{
text: __("File"), text: "__(File)",
child: [ child: [
{ text: __("New"), dataid: "#{@name}-New", shortcut: "A-N" }, { text: "__(New)", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" }, { text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Save"), dataid: "#{@name}-Save", shortcut: "C-S" }, { text: "__(Save)", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: __("Save as"), dataid: "#{@name}-Saveas", shortcut: "A-W" } { text: "__(Save as)", dataid: "#{@name}-Saveas", shortcut: "A-W" }
], ],
onmenuselect: (e) -> me.actionFile e.item.data.dataid onmenuselect: (e) -> me.actionFile e.item.data.dataid
}] }]

View File

@ -67,8 +67,8 @@ class MarketPlace extends this.OS.GUI.BaseApplication
menu: () -> menu: () ->
me = @ me = @
return [ return [
{ text: __("Options"), child: [ { text: "__(Options)", child: [
{ text: __("Repositories"), shortcut: "C-R" } { text: "__(Repositories)", shortcut: "C-R" }
] , onmenuselect: (e) -> ] , onmenuselect: (e) ->
me.openDialog "RepositoryDialog" me.openDialog "RepositoryDialog"
} }

View File

@ -242,12 +242,12 @@ class NotePad extends this.OS.GUI.BaseApplication
menu: () -> menu: () ->
me = @ me = @
menu = [{ menu = [{
text: __("File"), text: "__(File)",
child: [ child: [
{ text: __("New"), dataid: "#{@name}-New", shortcut: "A-N" }, { text: "__(New)", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" }, { text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Save"), dataid: "#{@name}-Save", shortcut: "C-S" }, { text: "__(Save)", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: __("Save as"), dataid: "#{@name}-Saveas", shortcut: "A-W" } { text: "__(Save as)", dataid: "#{@name}-Saveas", shortcut: "A-W" }
], ],
onmenuselect: (e) -> me.actionFile e.item.data.dataid onmenuselect: (e) -> me.actionFile e.item.data.dataid
}] }]

View File

@ -96,17 +96,16 @@ class Preview extends this.OS.GUI.BaseApplication
menu: () -> menu: () ->
me = @ me = @
menu = [{ menu = [{
text: __("File"), text: "__(File)",
child: [ child: [
{ text: __("Open"), dataid: "#{@name}-Open", shortcut: "A-O" }, { text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: __("Close"), dataid: "#{@name}-Close", shortcut: "C-X" }, { text: "__(Close)", dataid: "#{@name}-Close", shortcut: "C-X" },
], ],
onmenuselect: (e) -> me.actionFile e.item.data.dataid onmenuselect: (e) -> me.actionFile e.item.data.dataid
}] }]
menu menu
actionFile: (e) -> actionFile: (e) ->
console.log e
me = @ me = @
switch e switch e
when "#{@name}-Open" when "#{@name}-Open"