-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from open-falcon/i18n
i18n support
- Loading branch information
Showing
27 changed files
with
639 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[python: **.py] | ||
[jinja2: **/templates/**.html] | ||
extensions=jinja2.ext.autoescape,jinja2.ext.with_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Open-Falcon support zh_CN by default. Any translation will be appreciated. | ||
|
||
If you want to translate open-falcon to a new language or just refine the exist translation, you could follow the instructions below. | ||
|
||
## refine the exist translation | ||
|
||
1. find what you want to translate in the source code and replace it to `{{_('xxx')}}`. | ||
2. run `python ./scripts/tr_update.py`, it will update `rrd/translations/foo/LC_MESSAGES/messages.po`. | ||
3. run `python ./scripts/tr_compile.py`, it will generate a complied file in `rrd/translations/foo/LC_MESSAGES/messages.mo` | ||
|
||
|
||
## create a new language(such as Spanish support) | ||
1. update `rrd/config.py`, add a new key to `LANGUAGES`, such as: | ||
|
||
LANGUAGES = { | ||
'en': 'English', | ||
'zh_CN': 'Chinese-Simplified', | ||
'es': Spanish, | ||
} | ||
|
||
2. run `python ./scripts/tr_init.py`, it will update `rrd/translations/es/LC_MESSAGES/messages.po`. | ||
3. find what you want to translate in the source code and replace it to `{{_('xxx')}}`. | ||
4. run `python ./scripts/tr_update.py`, it will update `rrd/translations/es/LC_MESSAGES/messages.po`. | ||
5. run `python ./scripts/tr_compile.py`, it will generate a complied file in `rrd/translations/es/LC_MESSAGES/messages.mo` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Flask==0.10.1 | ||
Flask-Babel==0.9 | ||
Jinja2==2.7.2 | ||
Werkzeug==0.9.4 | ||
gunicorn==18.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,15 @@ | |
LDAP_TLS_REQUIRE_CERT = True | ||
LDAP_TLS_CIPHER_SUITE = "" | ||
|
||
# i18n | ||
BABEL_DEFAULT_LOCALE = 'zh_CN' | ||
BABEL_DEFAULT_TIMEZONE = 'Asia/Shanghai' | ||
# aviliable translations | ||
LANGUAGES = { | ||
'en': 'English', | ||
'zh_CN': 'Chinese-Simplified', | ||
} | ||
|
||
# portal site config | ||
MAINTAINERS = ['root'] | ||
CONTACT = '[email protected]' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.