diff --git a/docs/README.md b/docs/README.md index 61359ad..2824139 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,6 +21,7 @@ You can edit `mkdocs.yml` and change for Chinese. * [Implement search in angular](en/development/implement-search-with-angular.md) * [Implement angular filter](en/development/implement-angular-filter.md) * [Seagull design and implement](en/development/seagull-design-and-implement.md) +* [Seagull translate guide](en/development/seagull-translate-guide.md) * [Use AngularJS](en/development/use-angularjs.md) * [Use animate.css](en/development/use-animate-css.md) * [Use Beego as api server](en/development/use-beego-as-api-server.md) @@ -46,6 +47,7 @@ You can edit `mkdocs.yml` and change for Chinese. * [在Angular实现搜索](zh/development/implement-search-with-angular.md) * [实现Angular过滤器](zh/development/implement-angular-filter.md) * [海鸥的设计与实现](zh/development/seagull-design-and-implement.md) +* [海鸥翻译指南](zh/development/seagull-translate-guide.md) * [使用AngularJS](zh/development/use-angularjs.md) * [使用Animate.css](zh/development/use-animate-css.md) * [使用Beego为API服务器](zh/development/use-beego-as-api-server.md) diff --git a/docs/en/development/seagull-translate-guide.md b/docs/en/development/seagull-translate-guide.md index e69de29..1a92700 100644 --- a/docs/en/development/seagull-translate-guide.md +++ b/docs/en/development/seagull-translate-guide.md @@ -0,0 +1,60 @@ +# Seagull translate guide + +## Support I18n + +Now seagull support multiple languages including English, Chinese, German and French. + +We're using angular-translate library to implement i18n. If you want to support new languages, just add the translation in the code and seagull will use it automatically. + +## Translate guide + +Before writing the code, your can refer to [pr#19](https://github.com/tobegit3hub/seagull/pull/19) and [pr#26](https://github.com/tobegit3hub/seagull/pull/26) to know about the code of translation. + +All you need is translating the basic words in [seagull/static/js/app.js](https://github.com/tobegit3hub/seagull/blob/master/static/js/app.js). Just copy-and-paste the codes from English section and translate them in your languages. + +And make sure to write the following function so that we can change the language easily. + +``` +/* Determine it is English or not */ +$scope.isEnUs = function () { + return $translate.use() == "en-us"; +} + +/* Determine it is simplified Chinese or not */ +$scope.isZhCn = function () { + return $translate.use() == "zh-cn"; +} + +/* Determine it is traditional Chinese or not */ +$scope.isZhHant = function () { + return $translate.use() == "zh-hant"; +} + +/* Determine it is German or not */ +$scope.isDeDe = function () { + return $translate.use() == "de-de"; +} + +/* Determine it is French or not */ +$scope.isFrFr = function () { + return $translate.use() == "fr-fr"; +} +``` + +Finally, add your button in the front-end page [seagull/views/index.html](https://github.com/tobegit3hub/seagull/blob/master/views%2Findex.html). + +``` + +