Skip to content

Commit

Permalink
Merge pull request #1041 from c2corg/chinese-translation
Browse files Browse the repository at this point in the history
Add chinese translations
  • Loading branch information
cbeauchesne authored Apr 7, 2020
2 parents 1d908e7 + d2a4d39 commit 51f7ca4
Show file tree
Hide file tree
Showing 9 changed files with 1,606 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"lint": "vue-cli-service lint",
"lint:no-fix": "vue-cli-service lint --no-fix",
"messages:extract": "node tools/extract-messages.js",
"messages:compile": "node ./tools/compile-messages.js --user api:$TRANSIFEX_TOKEN",
"generate-icons": "node tools/generate-icons.js",
"update-c2c-common": "python3 tools/update-c2c-common.py",
"snyk-protect": "snyk protect",
Expand Down
2 changes: 1 addition & 1 deletion src/components/feed-widget/FeedWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
}
const params = {
pl: this.$language.current,
pl: this.$language.current === 'zh_CN' ? 'en' : this.$language.current,
token: this.paginationToken,
u: this.$route.params.id
};
Expand Down
2 changes: 2 additions & 0 deletions src/js/apis/c2c/DocumentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ DocumentService.prototype.get = function(id, lang) {
};

DocumentService.prototype.getCooked = function(id, prefered_lang) {
// chinese is not yet present as topoguide lang, so default it to english
prefered_lang = prefered_lang === 'zh_CN' ? 'en' : prefered_lang;
const promise = this.api.get('/' + this.documentType + 's/' + id + `?cook=${prefered_lang}`);

return promise;
Expand Down
1 change: 1 addition & 0 deletions src/js/apis/forum.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Forum.prototype.getLatest = function(excludeCategoryIds) {
};

Forum.prototype.readAnnouncement = function(lang) {
lang = lang === 'zh_CN' ? 'en' : lang;
return this.get('/t/annonce-' + lang + '.json');
};

Expand Down
2 changes: 1 addition & 1 deletion src/js/vue-plugins/document-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default function install(Vue) {
}
}

result.lang = lang;
result.lang = lang === 'zh_CN' ? 'en' : lang;

return result;
},
Expand Down
5 changes: 4 additions & 1 deletion src/js/vue-plugins/gettext-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ function getMessages(lang) {
return import(/* webpackChunkName: "translations-de" */`@/translations/dist/de.json`);
} else if (lang === 'es') {
return import(/* webpackChunkName: "translations-es" */`@/translations/dist/es.json`);
} else if (lang === 'zh_CN') {
return import(/* webpackChunkName: "translations-es" */`@/translations/dist/zh_CN.json`);
}

throw new Error(`Unsuported language : ${lang}`);
Expand All @@ -92,7 +94,8 @@ export default function install(Vue) {
en: 'English',
es: 'Español',
ca: 'Català',
eu: 'Euskara'
eu: 'Euskara',
zh_CN: 'Chinese'
};

this.translations = {};
Expand Down
Loading

0 comments on commit 51f7ca4

Please sign in to comment.