Skip to content

Commit

Permalink
let i18n use yaml rather than csv (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
twd2 authored Aug 14, 2016
1 parent b5d8b37 commit dc7e0ff
Show file tree
Hide file tree
Showing 11 changed files with 522 additions and 273 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ colorlog
httpagentparser
geoip2
GitPython
PyYAML
3 changes: 1 addition & 2 deletions vj4/handler/i18n.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from vj4 import app
from vj4 import error
from vj4.handler import base
from vj4.util import locale


@app.route('/lang/{lang}', 'language_set')
class LanguageView(base.Handler):
@base.route_argument
@base.sanitize
async def get(self, *, lang: str):
if not lang in ['zh_CN', 'en']:
raise error.ValidationError('lang')
await self.set_settings(view_lang=lang)
self.json_or_redirect(self.referer_or_main)
30 changes: 0 additions & 30 deletions vj4/locale/en.csv

This file was deleted.

34 changes: 34 additions & 0 deletions vj4/locale/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#English
---
contest_create: Contest Create
contest_main: Contest
contest_status: Contest Status
discussion_create: Create Discussion
discussion_main: Discussion
discussion_node: Discussion
home_account: Account
home_messages: Messages
home_security: Security
judge_playground: Judge Playground
main: Home
pager_first: « First
pager_last: Last »
pager_next: Next ›
pager_previous: ‹ Previous
problem_create: Problem Create
problem_edit: Problem Edit
problem_main: Problem Set
problem_solution: Problem Solution
problem_submit: Problem Submit
record_detail: Record Detail
record_main: Judging Queue
setting_function: Function
setting_info: Personal Info
setting_preference: Preference
setting_privacy: Privacy
training_main: Training
user_detail: User Detail
user_login: Login
user_logout: Logout
user_lostpass: Lost Password
user_register: Register
229 changes: 0 additions & 229 deletions vj4/locale/zh_CN.csv

This file was deleted.

Loading

0 comments on commit dc7e0ff

Please sign in to comment.