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

View File

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

View File

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

View File

@ -9,6 +9,8 @@
"Application {0} is not executable":"Application {0} is not executable",
"Application":"Application",
"Applications":"Applications",
"April":"April",
"August":"August",
"Authentication":"Authentication",
"Cancel":"Cancel",
"Cannot Edit category":"Cannot Edit category",
@ -43,6 +45,7 @@
"Copy":"Copy",
"Created: {0}":"Created: {0}",
"Cut":"Cut",
"December":"December",
"Delete a post":"Delete a post",
"Delete category":"Delete category",
"Delete section":"Delete section",
@ -78,6 +81,7 @@
"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",
"February":"February",
"File name":"File name",
"File not found {0}":"File not found {0}",
"File {0} copied":"File {0} copied",
@ -86,6 +90,7 @@
"Folder name":"Folder name",
"Format : [name] url":"Format : [name] url",
"Found {0} sections":"Found {0} sections",
"Fri":"Fri",
"From":"From",
"Full name must be entered":"Full name must be entered",
"Full name":"Full name",
@ -96,6 +101,9 @@
"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",
"January":"January",
"July":"July",
"June":"June",
"Kill process":"Kill process",
"Language file {0} not found":"Language file {0} not found",
"Launch":"Launch",
@ -103,8 +111,11 @@
"Location":"Location",
"Log out":"Log out",
"Logout":"Logout",
"March":"March",
"May":"May",
"Mime type {0} is not supported":"Mime type {0} is not supported",
"Modify section entry":"Modify section entry",
"Mon":"Mon",
"Move to":"Move to",
"Name":"Name",
"Navigation bar":"Navigation bar",
@ -115,7 +126,9 @@
"No application available to open {0}":"No application available to open {0}",
"No post found: {0}":"No post found: {0}",
"No":"No",
"November":"November",
"OS":"OS",
"October":"October",
"Ok":"Ok",
"Only {0} could be selected":"Only {0} could be selected",
"Open file":"Open file",
@ -147,25 +160,32 @@
"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}",
"Sat":"Sat",
"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",
"Selected: {0} ({1} bytes)":"Selected: {0} ({1} bytes)",
"September":"September",
"Service":"Service",
"Share file":"Share file",
"Shared url: {0}":"Shared url: {0}",
"Shared":"Shared",
"Short biblio":"Short biblio",
"Sidebar":"Sidebar",
"Size":"Size",
"Subtitle":"Subtitle",
"Sun":"Sun",
"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",
"Thu":"Thu",
"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",
"Tue":"Tue",
"Type":"Type",
"Uninstall : {0}?":"Uninstall : {0}?",
"Uninstall":"Uninstall",
@ -189,6 +209,7 @@
"VFS unknown action: {0}":"VFS unknown action: {0}",
"VFS unknown handler: {0}":"VFS unknown handler: {0}",
"View":"View",
"Wed":"Wed",
"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",

View File

@ -2,7 +2,7 @@
ord() {
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)
echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json"
done

View File

@ -43,154 +43,154 @@
"Copy":"Copy",
"Created: {0}":"Tạo: {0}",
"Cut":"Cắt",
"Delete a post":"Delete a post",
"Delete category":"Delete category",
"Delete section":"Delete section",
"Delete":"Delete",
"Delete a post":"Xoá bài",
"Delete category":"Xoá danh mục",
"Delete section":"Xoá mục",
"Delete":"Xoá",
"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",
"Dialog {0} not found":"Không tìm thấy hộp thoại {0}",
"Do you really want to delete this post ?":"Bạn muốn xoá bài này ?",
"Do you really want to delete: {0}?":"Bạn muốn xoá: {0}?",
"Download":"Tải về",
"Edit category":"Sửa danh mục",
"Edit repository":"Sửa kho ứng dụng",
"Edit":"Sửa",
"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",
"Error find app by mimes {0}":"Lỗi khi tìm app bằng mime {0}",
"Error reading package meta data: {0}":"Lỗi khi đọc thông tin ứng dụng: {0}",
"Error saving file {0}":"Lỗi khi lưu file {0}",
"Exit":"Thoát",
"Fail to create directory: {0}":"Lỗi khi tạo folder: {0}",
"Fail to create {0}: {1}":"Lỗi khi tạo {0}: {1}",
"Fail to delete {0}: {1}":"Lỗi khi xoá {0}: {1}",
"Fail to delete: {0}":"Lỗi khi xoá: {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}":"Lỗi truy vấn thông tin file: {0}",
"Fail to make request: {0}":"Lỗi truy vấn: {0}",
"Fail to move file: {0} -> {1}":"Lỗi di chuyển file: {0} -> {1}",
"Fail to paste: {0}":"Lỗi khi dán: {0}",
"Fail to publish file: {0}":"Lỗi khi xuất bản file: {0}",
"Fail to query data from database: {0}":"Lỗi truy vấn cơ sở dữ liệu: {0}",
"Fail to read file: {0}":"Lỗi đọc file: {0}",
"Fail to rename to {0}: {1}":"Lỗi khi đổi tên file {0}: {1}",
"Fail to scan directory: {0}":"Lỗi khi quét thư mục: {0}",
"Fail to upload file to: {0}":"Lỗi khi tải file lên: {0}",
"Fail to upload to {0}: {1}":"Lỗi khi tải file lên {0}: {1}",
"Fail to write to file: {0}":"Lỗi khi ghi file: {0}",
"Fail to {0} package":"Lỗi {0} ứng dụng",
"File name":"Tên file",
"File not found {0}":"Không tìm thấy file {0}",
"File {0} copied":"Đã copy file {0}",
"File {0} cut":"Đã cắt file {0}",
"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",
"Folder name":"Tên thư mục",
"Format : [name] url":"Định dạng : [name] url",
"Found {0} sections":"Tìm thấy {0} mục",
"From":"Từ",
"Full name must be entered":"Vui lòng điền họ và tên",
"Full name":"Họ và tên",
"Google Drive":"Google Drive",
"Hidden files":"Hidden files",
"Hidden files":"File ẩn",
"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",
"Icon view":"Xêm theo icon",
"Ignore all {0} unsaved files ?":"Bỏ qua {0} file chưa lưu ?",
"Install":"Cài đặt",
"Invalid package: Meta data file not found":"Ứng dụng không hợp lệ: không tìm thấy metadata",
"Kill process":"Đóng process",
"Language file {0} not found":"Không tìm thấy ngôn ngữ {0}",
"Launch":"Khởi chạy",
"List view":"Xem theo list",
"Location":"Vị trí",
"Log out":"Đăng xuất",
"Logout":"Đăng xuất",
"Mime type {0} is not supported":"Mime type {0} không được hổ trợ",
"Modify section entry":"Sửa mục",
"Move to":"Di chuyển vào",
"Name":"Tên",
"Navigation bar":"Thanh điều hướng",
"New file":"File mới",
"New folder":"Thư mục mới",
"New section entry for {0}":"Thêm mới mục trong {0}",
"New":"Tạo mới",
"No application available to open {0}":"Không tìm thấy ứng dụng dể đọc {0}",
"No post found: {0}":"Không tìm thấy bài: {0}",
"No":"Không",
"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",
"Ok":"",
"Only {0} could be selected":"Chỉ file với mine {0} mới được chọn",
"Open file":"Mở file",
"Open with":"Mở với",
"Open":"Mở",
"Options":"Tuỳ chọn",
"Package uninstalled":"Đã gỡ bỏ ứng dụng",
"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":"Dán",
"Phone":"Số điện thoại",
"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",
"Please enter category name":"Vui lòng nhập tên danh mục",
"Please enter tags":"Vui lòng nhập tags",
"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":"Vui lòng chọn danh mục",
"Please select a date":"Vui lòng chọn ngày",
"Please select a file":"Vui lòng chọn file",
"Please select a parent category":"Vui lòng chọn danh much cha",
"Please select a section to edit":"Vui lòng chọn mục để sửa",
"Please select a section to move":"Vuil lòng chọn mục để di chuyển",
"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",
"Properties":"Thông tin",
"Quit without saving ?":"Thoát mà không lưu ?",
"Quit":"Thoát",
"Read more":"Đọc thêm",
"Refresh":"Làm mới",
"Rename":"Đổi tên",
"Repositories":"Các kho ứng dụng",
"Resource not found {0}":"Không tìm thấy tài nguyên {0}",
"Resource not found: {0}":"Không tìm thấy tài nguyên: {0}",
"Row {0}, col {1}, lines: {2}":"Hàng {0}, cột {1}, dòng: {2}",
"Save as":"Lưu như",
"Save":"Lưu",
"Section list is empty, please add one":"Danh sách mục rỗng, vui lòng tạo mới",
"Select image file":"Chọn file ảnh",
"Service":"Dịch vụ",
"Share file":"Chia sẻ",
"Shared url: {0}":"Liên kết chia sẻ: {0}",
"Shared":"Đã chia sẻ",
"Short biblio":"Tiểu sử ngắn",
"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",
"Subtitle":"Tiêu đề con",
"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":"Lỗi hệ thống: không thể khởi chạy màn hình đăng nhập",
"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",
"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":"Tiêu đề hoặc nội dụng không được để trống",
"Title":"Tiêu đề",
"Toggle Full screen":"Bật/tắt toàn màn hình",
"Tree view":"Xem theo cây",
"Type":"Loại",
"Uninstall : {0}?":"Gỡ cài đặt : {0}?",
"Uninstall":"Gỡ cài đặt",
"Unknown API setting for {0}":"Không tìm thấy cài đặt API của {0}",
"Updated: {0}":"Đã cập nhật: {0}",
"Upload":"Tải lên",
"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"
"User abort the authentication":"Người dùng huỷ xác thực",
"User data updated":"Thông tin người dùng đã được cập nhật",
"VDB Unknown condition for delete command":"VDB không rõ điều kiện cho lệnh xoá",
"VFS Cannot encode file: {0}":"VFS Không thể mã hoá file: {0}",
"VFS cannot create : {0}":"VFS không thể tạo : {0}",
"VFS cannot delete : {0}":"VFS không thể xoá : {0}",
"VFS cannot download file : {0}":"VFS không thể tải về : {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 không thể khởi động {0}: {1}",
"VFS cannot move : {0}":"VFS không thể di chuyển : {0}",
"VFS cannot read : {0}":"VFS không thể đọc : {0}",
"VFS cannot save : {0}":"VFS không thể lưu : {0}",
"VFS cannot write : {0}":"VFS không thể viết : {0}",
"VFS unknown action: {0}":"VFS không rõ hành động : {0}",
"VFS unknown handler: {0}":"VFS không rõ trình xữ lý: {0}",
"View":"Xem",
"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":"Sai định dạng: định dạng hợp lệ [name] url",
"Yes":"",
"{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.appearance = conf.appearance if conf.appearance
_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.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
_OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu
@ -32,6 +31,7 @@
user: "home:///.packages",
system: "os:///packages"
} 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.repositories = [] unless _OS.setting.system.repositories
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
@ -45,7 +45,7 @@
} unless _OS.setting.VFS.gdrive
#search for app
_API.onsearch __("Applications"), (t) ->
_API.onsearch "__(Applications)", (t) ->
ar = []
term = new RegExp t, "i"
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 if = {minimizable == true} class = "afx-window-minimize" onclick = {minimize}></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>
<div class = "afx-clear"></div>
<div ref = "content" class = "afx-window-content">
@ -49,6 +49,10 @@
{
return self[k]
}
self.root.update = function()
{
self.update()
}
minimize()
{
this.root.observable.trigger("hide")

View File

@ -62,7 +62,7 @@
self.year = 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)
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:""} >
<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>
{ parse(text) }
{ text?text.toString().__():"" }
</span>
<script>
this.iconclass = opts.iconclass
@ -29,16 +29,5 @@
{
return self[k]
}
parse(text)
{
if(!text) return ""
match = text.toString().match(/^__\((.*)\)$/)
if(match)
{
return window.__(match[1])
}
else
return text
}
</script>
</afx-label>

View File

@ -39,6 +39,10 @@
{
return self[k]
}
self.root.update = function()
{
self.update()
}
this.on('mount', function() {
//console.log(self.refs.aOsmenu.root)
$(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.quit() if app
header = [{width:50,value:__("Pid")},{value:__("Name")}, {value:__("Type"), width:80},{width:75,value:__("Alive (ms)")}]
header = [{width:50,value: "__(Pid)"},{value:"__(Name)"}, {value:"__(Type)", width:80},{width:75,value: "__(Alive (ms))"}]
@gdata =
processes:{}
alive:[]
@ -36,7 +36,7 @@ class ActivityMonitor extends this.OS.GUI.BaseApplication
{icon:if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon,
iconclass:if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
value:a.name},
{value: if _APP[a.name].type == 1 then __("Application") else __("Service")}
{value: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"}
{value: now - a.birth}
]
me.gdata.alive.push a.pid

View File

@ -378,7 +378,6 @@ class Blogger extends this.OS.GUI.BaseApplication
]
@blogdb.find cond, (r) ->
return me.notify __("No post found: {0}", r.error) if r.error
console.log r.result
for v in r.result
v.text = v.title
v.complex = true

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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