refinerycms-i18n 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/REFINERY_README +8 -0
  2. data/Rakefile +34 -0
  3. data/config/locales/ar.yml +121 -0
  4. data/config/locales/bg.yml +198 -0
  5. data/config/locales/bn-IN.yml +180 -0
  6. data/config/locales/bs.yml +114 -0
  7. data/config/locales/ca-ES.yml +155 -0
  8. data/config/locales/cz.rb +166 -0
  9. data/config/locales/da.yml +167 -0
  10. data/config/locales/de-AT.yml +140 -0
  11. data/config/locales/de.yml +141 -0
  12. data/config/locales/dsb.yml +182 -0
  13. data/config/locales/el.yml +191 -0
  14. data/config/locales/es-AR.yml +168 -0
  15. data/config/locales/es-CO.yml +146 -0
  16. data/config/locales/es-MX.yml +118 -0
  17. data/config/locales/es.yml +186 -0
  18. data/config/locales/et.yml +109 -0
  19. data/config/locales/fa.yml +119 -0
  20. data/config/locales/fi.yml +154 -0
  21. data/config/locales/fr-CH.yml +123 -0
  22. data/config/locales/fr.yml +140 -0
  23. data/config/locales/fun/en-AU.rb +105 -0
  24. data/config/locales/fun/gibberish.rb +109 -0
  25. data/config/locales/fur.yml +141 -0
  26. data/config/locales/gl-ES.yml +193 -0
  27. data/config/locales/he.yml +103 -0
  28. data/config/locales/hr.yml +116 -0
  29. data/config/locales/hsb.yml +190 -0
  30. data/config/locales/hu.yml +144 -0
  31. data/config/locales/id.yml +122 -0
  32. data/config/locales/is.yml +142 -0
  33. data/config/locales/it.yml +146 -0
  34. data/config/locales/ja.yml +139 -0
  35. data/config/locales/ko.yml +153 -0
  36. data/config/locales/lo.yml +201 -0
  37. data/config/locales/lt.yml +141 -0
  38. data/config/locales/lv.yml +132 -0
  39. data/config/locales/mk.yml +115 -0
  40. data/config/locales/nb.yml +103 -0
  41. data/config/locales/nl.yml +173 -0
  42. data/config/locales/nn.yml +96 -0
  43. data/config/locales/pl.yml +127 -0
  44. data/config/locales/pt-BR.yml +148 -0
  45. data/config/locales/pt-PT.yml +220 -0
  46. data/config/locales/rm.yml +134 -0
  47. data/config/locales/ro.yml +152 -0
  48. data/config/locales/ru.yml +210 -0
  49. data/config/locales/sk.yml +139 -0
  50. data/config/locales/sl.yml +190 -0
  51. data/config/locales/sr-Latn.yml +116 -0
  52. data/config/locales/sr.yml +116 -0
  53. data/config/locales/sv-SE.yml +191 -0
  54. data/config/locales/sw.yml +123 -0
  55. data/config/locales/th.rb +222 -0
  56. data/config/locales/tr.yml +139 -0
  57. data/config/locales/uk.yml +237 -0
  58. data/config/locales/vi.yml +198 -0
  59. data/config/locales/zh-CN.yml +131 -0
  60. data/config/locales/zh-TW.yml +132 -0
  61. data/i18n-js-readme.rdoc +249 -0
  62. data/lib/gemspec.rb +29 -0
  63. data/lib/refinery/i18n-filter.rb +38 -0
  64. data/lib/refinery/i18n-js.rb +132 -0
  65. data/lib/refinery/i18n-js.yml +4 -0
  66. data/lib/refinery/i18n.js +339 -0
  67. data/lib/refinery/i18n.rb +146 -0
  68. data/lib/refinery/translate.rb +13 -0
  69. data/lib/tasks/i18n-js_tasks.rake +16 -0
  70. data/lib/tasks/translate.rake +200 -0
  71. data/lib/translate/file.rb +35 -0
  72. data/lib/translate/keys.rb +123 -0
  73. data/lib/translate/log.rb +39 -0
  74. data/lib/translate/storage.rb +20 -0
  75. data/test/i18n-test.html +50 -0
  76. data/test/i18n-test.js +661 -0
  77. data/test/i18n_js_test.rb +168 -0
  78. data/test/jsunittest/jsunittest.js +1017 -0
  79. data/test/jsunittest/unittest.css +54 -0
  80. data/test/resources/custom_path.yml +4 -0
  81. data/test/resources/default.yml +4 -0
  82. data/test/resources/locales.yml +76 -0
  83. data/test/resources/multiple_files.yml +6 -0
  84. data/test/resources/no_scope.yml +3 -0
  85. data/test/resources/simple_scope.yml +4 -0
  86. data/test/test_helper.rb +24 -0
  87. data/translate-readme.md +61 -0
  88. metadata +154 -0
@@ -0,0 +1,131 @@
1
+ # Chinese (China) translations for Ruby on Rails
2
+ # by tsechingho (http://github.com/tsechingho)
3
+
4
+ "zh-CN":
5
+ date:
6
+ formats:
7
+ default: "%Y-%m-%d"
8
+ short: "%b%d日"
9
+ long: "%Y年%b%d日"
10
+ day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
11
+ abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
12
+ month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
13
+ abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
14
+ order: [ :year, :month, :day ]
15
+
16
+ time:
17
+ formats:
18
+ default: "%Y年%b%d日 %A %H:%M:%S %Z"
19
+ short: "%b%d日 %H:%M"
20
+ long: "%Y年%b%d日 %H:%M"
21
+ am: "上午"
22
+ pm: "下午"
23
+
24
+ datetime:
25
+ distance_in_words:
26
+ half_a_minute: "半分钟"
27
+ less_than_x_seconds:
28
+ one: "不到一秒"
29
+ other: "不到 %{count} 秒"
30
+ x_seconds:
31
+ one: "一秒"
32
+ other: "%{count} 秒"
33
+ less_than_x_minutes:
34
+ one: "不到一分钟"
35
+ other: "不到 %{count} 分钟"
36
+ x_minutes:
37
+ one: "一分钟"
38
+ other: "%{count} 分钟"
39
+ about_x_hours:
40
+ one: "大约一小时"
41
+ other: "大约 %{count} 小时"
42
+ x_days:
43
+ one: "一天"
44
+ other: "%{count} 天"
45
+ about_x_months:
46
+ one: "大约一个月"
47
+ other: "大约 %{count} 个月"
48
+ x_months:
49
+ one: "一个月"
50
+ other: "%{count} 个月"
51
+ about_x_years:
52
+ one: "大约一年"
53
+ other: "大约 %{count} 年"
54
+ over_x_years:
55
+ one: "一年多"
56
+ other: "%{count} 年多"
57
+ prompts:
58
+ year: "年"
59
+ month: "月"
60
+ day: "日"
61
+ hour: "时"
62
+ minute: "分"
63
+ second: "秒"
64
+
65
+ number:
66
+ format:
67
+ separator: "."
68
+ delimiter: ","
69
+ precision: 3
70
+ currency:
71
+ format:
72
+ format: "%u %n"
73
+ unit: "CN¥"
74
+ separator: "."
75
+ delimiter: ","
76
+ precision: 2
77
+ percentage:
78
+ format:
79
+ delimiter: ""
80
+ precision:
81
+ format:
82
+ delimiter: ""
83
+ human:
84
+ format:
85
+ delimiter: ""
86
+ precision: 1
87
+ storage_units:
88
+ format: "%n %u"
89
+ units:
90
+ byte:
91
+ one: "Byte"
92
+ other: "Bytes"
93
+ kb: "KB"
94
+ mb: "MB"
95
+ gb: "GB"
96
+ tb: "TB"
97
+
98
+ support:
99
+ array:
100
+ words_connector: ", "
101
+ two_words_connector: " 和 "
102
+ last_word_connector: ", 和 "
103
+
104
+ activerecord:
105
+ errors:
106
+ template:
107
+ header:
108
+ one: "有 1 个错误发生导致「%{model}」无法被保存。"
109
+ other: "有 %{count} 个错误发生导致「%{model}」无法被保存。"
110
+ body: "如下字段出现错误:"
111
+ messages:
112
+ record_invalid: "校验失败: %{errors}"
113
+ inclusion: "不包含于列表中"
114
+ exclusion: "是保留关键字"
115
+ invalid: "是无效的"
116
+ confirmation: "与确认值不匹配"
117
+ accepted: "必须是可被接受的"
118
+ empty: "不能留空"
119
+ blank: "不能为空字符"
120
+ too_long: "过长(最长为 %{count} 个字符)"
121
+ too_short: "过短(最短为 %{count} 个字符)"
122
+ wrong_length: "长度非法(必须为 %{count} 个字符)"
123
+ taken: "已经被使用"
124
+ not_a_number: "不是数字"
125
+ greater_than: "必须大于 %{count}"
126
+ greater_than_or_equal_to: "必须大于或等于 %{count}"
127
+ equal_to: "必须等于 %{count}"
128
+ less_than: "必须小于 %{count}"
129
+ less_than_or_equal_to: "必须小于或等于 %{count}"
130
+ odd: "必须为单数"
131
+ even: "必须为双数"
@@ -0,0 +1,132 @@
1
+ # Chinese (Taiwan) translations for Ruby on Rails
2
+ # by tsechingho (http://github.com/tsechingho)
3
+
4
+ "zh-TW":
5
+ date:
6
+ formats:
7
+ default: "%Y-%m-%d"
8
+ short: "%b%d日"
9
+ long: "%Y年%b%d日"
10
+ day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
11
+ abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
12
+ month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
13
+ abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
14
+ order: [ :year, :month, :day ]
15
+
16
+ time:
17
+ formats:
18
+ default: "%Y年%b%d日 %A %H:%M:%S %Z"
19
+ short: "%b%d日 %H:%M"
20
+ long: "%Y年%b%d日 %H:%M"
21
+ am: "上午"
22
+ pm: "下午"
23
+
24
+ datetime:
25
+ distance_in_words:
26
+ half_a_minute: "半分鐘"
27
+ less_than_x_seconds:
28
+ one: "不到一秒"
29
+ other: "不到 %{count} 秒"
30
+ x_seconds:
31
+ one: "一秒"
32
+ other: "%{count} 秒"
33
+ less_than_x_minutes:
34
+ one: "不到一分鐘"
35
+ other: "不到 %{count} 分鐘"
36
+ x_minutes:
37
+ one: "一分鐘"
38
+ other: "%{count} 分鐘"
39
+ about_x_hours:
40
+ one: "大約一小時"
41
+ other: "大約 %{count} 小時"
42
+ x_days:
43
+ one: "一天"
44
+ other: "%{count} 天"
45
+ about_x_months:
46
+ one: "大約一個月"
47
+ other: "大約 %{count} 個月"
48
+ x_months:
49
+ one: "一個月"
50
+ other: "%{count} 個月"
51
+ about_x_years:
52
+ one: "大約一年"
53
+ other: "大約 %{count} 年"
54
+ over_x_years:
55
+ one: "一年多"
56
+ other: "%{count} 年多"
57
+ prompts:
58
+ year: "年"
59
+ month: "月"
60
+ day: "日"
61
+ hour: "時"
62
+ minute: "分"
63
+ second: "秒"
64
+
65
+ number:
66
+ format:
67
+ separator: "."
68
+ delimiter: ","
69
+ precision: 3
70
+ currency:
71
+ format:
72
+ format: "%u %n"
73
+ unit: "NT$"
74
+ separator: "."
75
+ delimiter: ","
76
+ precision: 2
77
+ percentage:
78
+ format:
79
+ delimiter: ""
80
+ precision:
81
+ format:
82
+ delimiter: ""
83
+ human:
84
+ format:
85
+ delimiter: ""
86
+ precision: 1
87
+ storage_units:
88
+ format: "%n %u"
89
+ units:
90
+ byte:
91
+ one: "Byte"
92
+ other: "Bytes"
93
+ kb: "KB"
94
+ mb: "MB"
95
+ gb: "GB"
96
+ tb: "TB"
97
+
98
+ support:
99
+ array:
100
+ words_connector: ", "
101
+ two_words_connector: " 和 "
102
+ last_word_connector: ", 和 "
103
+
104
+ activerecord:
105
+ errors:
106
+ template:
107
+ header:
108
+ one: "有 1 個錯誤發生使得「%{model}」無法被儲存。"
109
+ other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。"
110
+ body: "下面欄位有問題:"
111
+ messages:
112
+ inclusion: "沒有包含在列表中"
113
+ exclusion: "是被保留的"
114
+ invalid: "是無效的"
115
+ confirmation: "不符合確認值"
116
+ accepted: "必須是可被接受的"
117
+ empty: "不能留空"
118
+ blank: "不能是空白字元"
119
+ too_long: "過長(最長是 %{count} 個字)"
120
+ too_short: "過短(最短是 %{count} 個字)"
121
+ wrong_length: "字數錯誤(必須是 %{count} 個字)"
122
+ taken: "已經被使用"
123
+ not_a_number: "不是數字"
124
+ greater_than: "必須大於 %{count}"
125
+ greater_than_or_equal_to: "必須大於或等於 %{count}"
126
+ equal_to: "必須等於 %{count}"
127
+ less_than: "必須小於 %{count}"
128
+ less_than_or_equal_to: "必須小於或等於 %{count}"
129
+ odd: "必須是奇數"
130
+ even: "必須是偶數"
131
+
132
+
@@ -0,0 +1,249 @@
1
+ = I18n for JavaScript
2
+
3
+ It's a small library to provide the Rails I18n translations on the Javascript.
4
+
5
+ This library has been tested on:
6
+
7
+ * Safari 4 (Mac)
8
+ * Firefox 3.6 (Mac)
9
+ * Opera 10 (Mac)
10
+ * IE6+ (Mac Parallels)
11
+
12
+ == Usage
13
+
14
+ === Setting up
15
+
16
+ Run <tt>rake i18n:setup</tt> to copy <tt>i18n.js</tt> to your javascript directory and <tt>i18n-js.yml</tt> to your config folder (if not already present). Then you're ready to go!
17
+
18
+ Every time your application is started, the translations messages defined in your configuration file will be generated.
19
+
20
+ To speed up the development process, you can automatically export your messages by adding something
21
+ like this to your <tt>ApplicationController</tt>:
22
+
23
+ class ApplicationController < ActionController::Base
24
+ before_filter :export_i18n_messages
25
+
26
+ private
27
+ def export_i18n_messages
28
+ SimplesIdeias::I18n.export! if Rails.env.development?
29
+ end
30
+ end
31
+
32
+ ==== Configuration
33
+
34
+ The first time you will restart your application when using i18n-js, it will create you the default configuration file at <tt>#{Rails.root}/config/i18n-js.yml</tt>
35
+
36
+ Messages files can also be customized, you can even get more files generated to different folders and with different translations to best suit your needs.
37
+
38
+ Examples:
39
+
40
+ translations:
41
+ - file: 'public/javascripts/path-to-your-messages-file.js'
42
+ only: '*.date.formats'
43
+ - file: 'public/javascripts/path-to-your-second-file.js'
44
+ only: ['*.activerecord', '*.admin.*.title']
45
+
46
+ If <tt>only</tt> is omitted all the translations will be saved
47
+
48
+ To find more examples on how to use the configuration file please refer to the tests.
49
+
50
+ === On the Javascript
51
+
52
+ Set your locale is easy as
53
+
54
+ I18n.defaultLocale = "pt-BR";
55
+ I18n.locale = "pt-BR";
56
+ I18n.currentLocale();
57
+ // pt-BR
58
+
59
+ You can use it to translate your messages:
60
+
61
+ I18n.t("some.scoped.translation");
62
+
63
+ You can also interpolate values:
64
+
65
+ I18n.t("hello", {name: "John Doe"});
66
+
67
+ The sample above will assume that you have the following translations in your
68
+ <tt>config/locales/*.yml</tt>:
69
+
70
+ en:
71
+ hello: "Hello %{name}!"
72
+
73
+ You can set default values for missing scopes:
74
+
75
+ // simple translation
76
+ I18n.t("some.missing.scope", {defaultValue: "A default message"});
77
+
78
+ // with interpolation
79
+ I18n.t("noun", {defaultValue: "I'm a %{noun}", noun: "Mac"});
80
+
81
+ Pluralization is possible as well:
82
+
83
+ I18n.t("inbox.counting", {count: 10}); // You have 10 messages
84
+
85
+ The sample above expects the following translation:
86
+
87
+ en:
88
+ inbox:
89
+ counting:
90
+ one: You have 1 new message
91
+ other: You have %{count} new messages
92
+ zero: You have no messages
93
+
94
+ <b>NOTE:</b> Rais I18n recognizes the +zero+ option.
95
+
96
+ If you're using the same scope over and over again, you may use the +scope+ option.
97
+
98
+ var options = {scope: "activerecord.attributes.user"};
99
+
100
+ I18n.t("name", options);
101
+ I18n.t("email", options);
102
+ I18n.t("username", options);
103
+
104
+ You also provide an array as scope.
105
+
106
+ // use the greetings.hello scope
107
+ I18n.t(["greetings", "hello"]);
108
+
109
+ ==== Number formatting
110
+
111
+ Similar to Rails helpers, you have localize number and currency formatting.
112
+
113
+ I18n.l("currency", 1990.99);
114
+ // $1,990.99
115
+
116
+ I18n.l("number", 1990.99);
117
+ // 1,990.99
118
+
119
+ I18n.l("percentage", 123.45);
120
+ // 123.450%
121
+
122
+ To have more control over number formatting, you can use the <tt>I18n.toNumber</tt>, <tt>I18n.toPercentage</tt> and <tt>I18n.toCurrency</tt> functions.
123
+
124
+ I18n.toNumber(1000); // 1,000.000
125
+ I18n.toCurrency(1000); // $1,000.00
126
+ I18n.toPercentage(100); // 100.000%
127
+
128
+ The +toNumber+ and +toPercentage+ functions accept the following options:
129
+
130
+ * +precision+: defaults to 3
131
+ * +separator+: defaults to <tt>.</tt>
132
+ * +delimiter+: defaults to <tt>,</tt>
133
+
134
+ See some number formatting examples:
135
+
136
+ I18n.toNumber(1000, {precision: 0}); // 1,000
137
+ I18n.toNumber(1000, {delimiter: ".", separator: ","}); // 1.000,000
138
+ I18n.toNumber(1000, {delimiter: ".", precision: 0}); // 1.000
139
+
140
+ The +toCurrency+ function accepts the following options:
141
+
142
+ * +precision+: sets the level of precision
143
+ * +separator+: sets the separator between the units
144
+ * +delimiter+: sets the thousands delimiter
145
+ * +format+: sets the format of the output string
146
+ * +unit+: sets the denomination of the currency
147
+
148
+ You can provide only the options you want to override:
149
+
150
+ I18n.toCurrency(1000, {precision: 0}); /$1,000/
151
+
152
+ ==== Date formatting
153
+
154
+ // accepted formats
155
+ I18n.l("date.formats.short", "2009-09-18"); // yyyy-mm-dd
156
+ I18n.l("time.formats.short", "2009-09-18 23:12:43"); // yyyy-mm-dd hh:mm:ss
157
+ I18n.l("time.formats.short", "2009-11-09T18:10:34"); // JSON format with local Timezone (part of ISO-8601)
158
+ I18n.l("time.formats.short", "2009-11-09T18:10:34Z"); // JSON format in UTC (part of ISO-8601)
159
+ I18n.l("date.formats.short", 1251862029000); // Epoch time
160
+ I18n.l("date.formats.short", "09/18/2009"); // mm/dd/yyyy
161
+ I18n.l("date.formats.short", (new Date())); // Date object
162
+
163
+ If you prefer, you can use the <tt>I18n.strftime</tt> function to format dates.
164
+
165
+ var date = new Date();
166
+ I18n.strftime(date, "%d/%m/%Y");
167
+
168
+ The accepted formats are:
169
+
170
+ %a - The abbreviated weekday name (Sun)
171
+ %A - The full weekday name (Sunday)
172
+ %b - The abbreviated month name (Jan)
173
+ %B - The full month name (January)
174
+ %c - The preferred local date and time representation
175
+ %d - Day of the month (01..31)
176
+ %-d - Day of the month (1..31)
177
+ %H - Hour of the day, 24-hour clock (00..23)
178
+ %-H - Hour of the day, 24-hour clock (0..23)
179
+ %I - Hour of the day, 12-hour clock (01..12)
180
+ %-I - Hour of the day, 12-hour clock (1..12)
181
+ %m - Month of the year (01..12)
182
+ %-m - Month of the year (1..12)
183
+ %M - Minute of the hour (00..59)
184
+ %-M - Minute of the hour (0..59)
185
+ %p - Meridian indicator (AM or PM)
186
+ %S - Second of the minute (00..60)
187
+ %-S - Second of the minute (0..60)
188
+ %w - Day of the week (Sunday is 0, 0..6)
189
+ %y - Year without a century (00..99)
190
+ %-y - Year without a century (0..99)
191
+ %Y - Year with century
192
+ %z - Timezone offset (+0545)
193
+
194
+ Check out <tt>vendor/plugins/i18n-js/test/i18n-test.js</tt> for more examples!
195
+
196
+ == Using I18nJS with other languages (Python, PHP, ...)
197
+
198
+ The JavaScript library is language agnostic; so you can use it with PHP, Python, [you favorite language here].
199
+ The only requirement is that you need to set the +translations+ attribute like following:
200
+
201
+ I18n.translations = {};
202
+
203
+ I18n.translations["en"] = {
204
+ message: "Some special message for you"
205
+ }
206
+
207
+ I18n.translations["pt"] = {
208
+ message: "Uma mensagem especial para você"
209
+ }
210
+
211
+ == Maintainer
212
+
213
+ * Nando Vieira - http://simplesideias.com.br
214
+ * Sébastien Grosjean - http://github.com/ZenCocoon
215
+
216
+ == Contributing
217
+
218
+ Once you've made your great commits:
219
+
220
+ 1. Fork[http://help.github.com/forking/] I18n-JS
221
+ 2. Create a topic branch - <tt>git checkout -b my_branch</tt>
222
+ 3. Push to your branch - <tt>git push origin my_branch</tt>
223
+ 4. Create an Issue[http://github.com/fnando/i18n-js/issues] with a link to your branch
224
+ 5. That's it!
225
+
226
+ Please respect the indentation rules. And use tabs, not spaces (on the JavaScript).
227
+
228
+ == License
229
+
230
+ (The MIT License)
231
+
232
+ Permission is hereby granted, free of charge, to any person obtaining
233
+ a copy of this software and associated documentation files (the
234
+ 'Software'), to deal in the Software without restriction, including
235
+ without limitation the rights to use, copy, modify, merge, publish,
236
+ distribute, sublicense, and/or sell copies of the Software, and to
237
+ permit persons to whom the Software is furnished to do so, subject to
238
+ the following conditions:
239
+
240
+ The above copyright notice and this permission notice shall be
241
+ included in all copies or substantial portions of the Software.
242
+
243
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
244
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
245
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
246
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
247
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
248
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
249
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.