Skip to content

Commit

Permalink
Integrte with Transifex and add more languages
Browse files Browse the repository at this point in the history
  • Loading branch information
lgn21st committed Oct 29, 2014
1 parent bc28e36 commit 231c9fc
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[main]
host = https://www.transifex.com

[peatio.serverenyml]
file_filter = config/locales/server.<lang>.yml
source_file = config/locales/server.en.yml
source_lang = en
trans.zh_CN = config/locales/server.zh-CN.yml
trans.zh_TW = config/locales/server.zh-TW.yml
type = YML

[peatio.clientenyml]
file_filter = config/locales/client.<lang>.yml
source_file = config/locales/client.en.yml
source_lang = en
trans.zh_CN = config/locales/client.zh-CN.yml
trans.zh_TW = config/locales/client.zh-TW.yml
type = YML

3 changes: 3 additions & 0 deletions config/locales/client.de.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
de:
js:
brand: Peatio
4 changes: 2 additions & 2 deletions config/locales/client.en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
js:
en:
en:
js:
brand: Peatio
funds:
deposit: Deposit
Expand Down
3 changes: 3 additions & 0 deletions config/locales/client.ko.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ko:
js:
brand: Peatio
4 changes: 2 additions & 2 deletions config/locales/client.zh-CN.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
js:
zh-CN:
zh-CN:
js:
brand: 貔貅
funds:
deposit: 充值
Expand Down
3 changes: 3 additions & 0 deletions config/locales/client.zh-TW.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zh-TW:
js:
brand: 貔貅
2 changes: 2 additions & 0 deletions config/locales/server.de.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
de:
brand: Peatio
File renamed without changes.
2 changes: 2 additions & 0 deletions config/locales/server.ko.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ko:
brand: Peatio
File renamed without changes.
2 changes: 2 additions & 0 deletions config/locales/server.zh-TW.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zh-TW:
brand: 貔貅
6 changes: 4 additions & 2 deletions lib/js_locale_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module JsLocaleHelper

def self.load_yaml(locale)
YAML::load(File.open("#{Rails.root}/config/locales/client.#{locale}.yml"))['js']
locale_str = locale.to_s
translations = YAML::load(File.open("#{Rails.root}/config/locales/client.#{locale_str}.yml"))[locale_str]['js']
{locale_str => translations}
rescue
{}
{locale_str => {}}
end

def self.output_locale(locale=:en)
Expand Down

0 comments on commit 231c9fc

Please sign in to comment.