Skip to content

Commit

Permalink
Merge pull request #386 from 569258yin/master
Browse files Browse the repository at this point in the history
Add chinese language support
  • Loading branch information
HarveyKandola authored Jul 10, 2022
2 parents 68d067e + dc26f06 commit e70019d
Show file tree
Hide file tree
Showing 7 changed files with 769 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Languages supported out-of-the-box:

- English
- German
- Chinese(中文)

PR's welcome for additional languages.

Expand Down
1 change: 1 addition & 0 deletions core/i18n/localize.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var localeMap map[string]map[string]string
func SupportedLocales() (locales []string) {
locales = append(locales, "en-US")
locales = append(locales, "de-DE")
locales = append(locales, "zh-CN")

return
}
Expand Down
8 changes: 7 additions & 1 deletion gui/app/services/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Service, { inject as service } from '@ember/service';
import $ from 'jquery';

export default Service.extend({
langs: { enUS: [], deDE: [] },
langs: { enUS: [], deDE: [] , zhCN: [] },
locales: [],
session: service(),

Expand All @@ -21,6 +21,9 @@ export default Service.extend({
$.getJSON("/i18n/de-DE.json", (data) => {
this.langs.deDE = data;
});
$.getJSON("/i18n/zh-CN.json", (data) => {
this.langs.zhCN = data;
});
},

localize(key, ...args) {
Expand All @@ -33,6 +36,9 @@ export default Service.extend({
case "de-DE":
str = this.langs.deDE[key];
break;
case "zh-CN":
str = this.langs.zhCN[key];
break;
}

if (_.isUndefined(str)) {
Expand Down
2 changes: 1 addition & 1 deletion gui/app/templates/components/folder/space-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{#if (gt rootDocCount 0)}}
<div class="item {{if (eq selectedFilter "uncategorized") "selected"}}" {{action "onDocumentFilter" "uncategorized" space.id}} role="button" tabindex="0">
<i class={{concat "dicon " constants.Icon.Filter}} />
<div class="name">Uncategorized ({{rootDocCount}})</div>
<div class="name">{{localize 'un_categorized'}} ({{rootDocCount}})</div>
</div>
{{/if}}
{{/if}}
Expand Down
1 change: 1 addition & 0 deletions gui/public/i18n/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"status": "Status",
"expiry": "Ablauf",
"feedback": "Feedback",
"un_categorized": "Uncategorized",

"toc": "Inhaltsverzeichnis",
"new_canvas": "Leeres Dokument",
Expand Down
1 change: 1 addition & 0 deletions gui/public/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"status": "Status",
"expiry": "Expiry",
"feedback": "Feedback",
"un_categorized": "Uncategorized",

"toc": "table of contents",
"new_canvas": "Blank canvas",
Expand Down
Loading

0 comments on commit e70019d

Please sign in to comment.