Skip to content

Commit 231c9fc

Browse files
committed
Integrte with Transifex and add more languages
1 parent bc28e36 commit 231c9fc

12 files changed

+42
-6
lines changed

.tx/config

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[main]
2+
host = https://www.transifex.com
3+
4+
[peatio.serverenyml]
5+
file_filter = config/locales/server.<lang>.yml
6+
source_file = config/locales/server.en.yml
7+
source_lang = en
8+
trans.zh_CN = config/locales/server.zh-CN.yml
9+
trans.zh_TW = config/locales/server.zh-TW.yml
10+
type = YML
11+
12+
[peatio.clientenyml]
13+
file_filter = config/locales/client.<lang>.yml
14+
source_file = config/locales/client.en.yml
15+
source_lang = en
16+
trans.zh_CN = config/locales/client.zh-CN.yml
17+
trans.zh_TW = config/locales/client.zh-TW.yml
18+
type = YML
19+

config/locales/client.de.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
de:
2+
js:
3+
brand: Peatio

config/locales/client.en.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
js:
2-
en:
1+
en:
2+
js:
33
brand: Peatio
44
funds:
55
deposit: Deposit

config/locales/client.ko.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ko:
2+
js:
3+
brand: Peatio

config/locales/client.zh-CN.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
js:
2-
zh-CN:
1+
zh-CN:
2+
js:
33
brand: 貔貅
44
funds:
55
deposit: 充值

config/locales/client.zh-TW.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
zh-TW:
2+
js:
3+
brand: 貔貅

config/locales/server.de.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
de:
2+
brand: Peatio
File renamed without changes.

config/locales/server.ko.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ko:
2+
brand: Peatio
File renamed without changes.

config/locales/server.zh-TW.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
zh-TW:
2+
brand: 貔貅

lib/js_locale_helper.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module JsLocaleHelper
22

33
def self.load_yaml(locale)
4-
YAML::load(File.open("#{Rails.root}/config/locales/client.#{locale}.yml"))['js']
4+
locale_str = locale.to_s
5+
translations = YAML::load(File.open("#{Rails.root}/config/locales/client.#{locale_str}.yml"))[locale_str]['js']
6+
{locale_str => translations}
57
rescue
6-
{}
8+
{locale_str => {}}
79
end
810

911
def self.output_locale(locale=:en)

0 commit comments

Comments
 (0)