r18n-core 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +11 -0
- data/README.rdoc +135 -111
- data/base/ca.yml +31 -0
- data/base/de.yml +6 -6
- data/base/fi.yml +31 -0
- data/base/fr.yml +8 -8
- data/base/lv.yml +31 -0
- data/lib/r18n-core/version.rb +1 -1
- data/locales/ca.rb +20 -0
- data/locales/de.rb +3 -1
- data/locales/en-gb.rb +9 -0
- data/locales/en-us.rb +1 -1
- data/locales/eo.rb +1 -1
- data/locales/es.rb +1 -1
- data/locales/fi.rb +29 -0
- data/locales/lv.rb +33 -0
- data/locales/pl.rb +2 -2
- metadata +54 -47
data/ChangeLog
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
== 0.4.6 (Trinity)
|
2
|
+
* Add support for new interpolation syntax in Rails 3.
|
3
|
+
* Add Catalian locale (by Jordi Romero).
|
4
|
+
* Add Finish locale (by Laura Guillén).
|
5
|
+
* Add British locale (by JP Hastings-Spital).
|
6
|
+
* Add Latvian locale (by Iļja Ketris).
|
7
|
+
* Fix Spanish (by Jordi Romero), German, French, Esperanto (Iļja Ketris) and
|
8
|
+
Polish locales.
|
9
|
+
* Fix documentation (by Iļja Ketris and felix).
|
10
|
+
* Remove RubyGems from plugins requires.
|
11
|
+
|
1
12
|
== 0.4.5 (Annual)
|
2
13
|
* Filters for several types.
|
3
14
|
* Global HTML escaping run before Markdown and Textile formatting.
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= R18n
|
2
2
|
|
3
|
-
R18n is
|
3
|
+
R18n is an i18n tool to translate your Ruby application into several languages.
|
4
4
|
|
5
5
|
Use <tt>r18n-rails</tt>, <tt>sinatra-r18n</tt> or teamon’s <tt>merb_i18n</tt> to
|
6
6
|
localize Web applications and <tt>r18n-desktop</tt> to localize desktop
|
@@ -9,7 +9,7 @@ application.
|
|
9
9
|
== Features
|
10
10
|
|
11
11
|
=== Ruby-style Syntax
|
12
|
-
R18n uses hierarchical not English-
|
12
|
+
R18n uses hierarchical, not English-centric, YAML format for translations by
|
13
13
|
default:
|
14
14
|
|
15
15
|
user:
|
@@ -19,7 +19,7 @@ default:
|
|
19
19
|
1: There is 1 user
|
20
20
|
n: There are %1 users
|
21
21
|
|
22
|
-
To access translation you can call methods with same names:
|
22
|
+
To access translation you can call methods with the same names:
|
23
23
|
|
24
24
|
t.user.edit #=> "Edit user"
|
25
25
|
t.user.name('John') #=> "User name is John"
|
@@ -28,14 +28,15 @@ To access translation you can call methods with same names:
|
|
28
28
|
t.not.exists | 'default' #=> "default"
|
29
29
|
t.not.exists.translated? #=> false
|
30
30
|
|
31
|
-
If translation key
|
31
|
+
If the translation key is the name of an Object method you can access it via
|
32
|
+
hash index:
|
32
33
|
|
33
34
|
t[:methods] #=> "Methods"
|
34
35
|
|
35
36
|
=== Filters
|
36
37
|
|
37
|
-
You can add custom filters for
|
38
|
-
|
38
|
+
You can add custom filters for YAML types or any translated string. Filters are
|
39
|
+
cascading and can communicate with each other.
|
39
40
|
|
40
41
|
R18n already has filters for HTML escaping, lambdas, Textile and Markdown:
|
41
42
|
|
@@ -50,22 +51,22 @@ R18n already has filters for HTML escaping, lambdas, Textile and Markdown:
|
|
50
51
|
=== Flexibility
|
51
52
|
|
52
53
|
Translation variables and pluralization (“1 comment”, “5 comments”) are filters
|
53
|
-
too
|
54
|
-
filter from <tt>r18n-rails-api</tt> gem:
|
54
|
+
too, so you can extend or replace them. For example, you can use the ‘named
|
55
|
+
variables filter’ from the <tt>r18n-rails-api</tt> gem:
|
55
56
|
|
56
|
-
greeting: "Hi, {
|
57
|
+
greeting: "Hi, %{name}"
|
57
58
|
|
58
59
|
R18n::Filters.on(:named_variables)
|
59
60
|
t.greeting(name: 'John') #=> "Hi, John"
|
60
61
|
|
61
62
|
=== Flexible Locales
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
Locales extend the Locale class. For example, English locale extends the time
|
65
|
+
formatters:
|
65
66
|
|
66
67
|
l Date.now, :full #=> "30th of November, 2009"
|
67
68
|
|
68
|
-
|
69
|
+
Russian has built-in pluralization without any lambdas in YAML:
|
69
70
|
|
70
71
|
t.user.count(1) #=> "1 пользователь"
|
71
72
|
t.user.count(2) #=> "2 пользователя"
|
@@ -73,7 +74,7 @@ Or Russian has built-in different pluralization without any lambdas in YAML:
|
|
73
74
|
|
74
75
|
=== Loaders
|
75
76
|
|
76
|
-
R18n can load translations from
|
77
|
+
R18n can load translations from anywhere, not just from YAML files. You just
|
77
78
|
need to create loader object with 2 methods: +available+ and +load+:
|
78
79
|
|
79
80
|
class DBLoader
|
@@ -87,8 +88,9 @@ need to create loader object with 2 methods: +available+ and +load+:
|
|
87
88
|
|
88
89
|
R18n.set R18n::I18n.new(user_locales, DBLoader.new)
|
89
90
|
|
90
|
-
You can also set a list of different translation
|
91
|
-
which will be used
|
91
|
+
You can also set a list of different translation locations or set extension
|
92
|
+
locations which will be only used with application translation (useful for
|
93
|
+
plugins).
|
92
94
|
|
93
95
|
=== Object Translation
|
94
96
|
|
@@ -98,14 +100,14 @@ You can translate any class, including ORM models:
|
|
98
100
|
|
99
101
|
class Product < ActiveRecord::Base
|
100
102
|
include R18n::Translated
|
101
|
-
# Model has two
|
103
|
+
# Model has two normal properties: title_en and title_ru
|
102
104
|
translations :title
|
103
105
|
end
|
104
106
|
|
105
|
-
# For English
|
107
|
+
# For English users
|
106
108
|
product.title #=> "Anthrax"
|
107
109
|
|
108
|
-
# For Russian
|
110
|
+
# For Russian users
|
109
111
|
product.title #=> "Сибирская язва"
|
110
112
|
|
111
113
|
=== Localization
|
@@ -119,12 +121,10 @@ R18n can localize numbers and time:
|
|
119
121
|
|
120
122
|
=== Several User Languages
|
121
123
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
language (e.g., if translation isn’t available in Kazakh R18n will see in
|
127
|
-
Russian):
|
124
|
+
If a particular locale is requested but missing, R18n will automatically take
|
125
|
+
the next available language (according to the browser’s list of locales) and for
|
126
|
+
cultures with two official languages (e.g., exUSSR) it takes the second language
|
127
|
+
(e.g., if a translation isn’t available in Kazakh R18n will look for Russian):
|
128
128
|
|
129
129
|
i18n = R18n::I18n.new(['kk', 'de'], 'dir/with/translations')
|
130
130
|
|
@@ -138,22 +138,22 @@ Russian):
|
|
138
138
|
|
139
139
|
=== Agnostic
|
140
140
|
|
141
|
-
R18n has
|
141
|
+
R18n has an agnostic core package and plugins with out-of-box support for
|
142
142
|
Sinatra, Merb and desktop applications.
|
143
143
|
|
144
144
|
== Usage
|
145
145
|
|
146
|
-
To add i18n support to your app, you can use
|
146
|
+
To add i18n support to your app, you can use the particular plugin for your
|
147
147
|
environment: <tt>r18n-rails</tt>, <tt>sinatra-r18n</tt> or
|
148
148
|
<tt>r18n-desktop</tt>.
|
149
149
|
|
150
|
-
If you develop you own plugin or want to use only core gem, you
|
151
|
-
I18n object and
|
152
|
-
by <tt>R18n.thread_set</tt>:
|
150
|
+
If you develop you own plugin or want to use only core gem, you will need to
|
151
|
+
create an I18n object and by using <tt>R18n.set</tt> or, for the current thread,
|
152
|
+
by using <tt>R18n.thread_set</tt>:
|
153
153
|
|
154
154
|
R18n.set(R18n::I18n.new('en', 'path/to/translations'))
|
155
155
|
|
156
|
-
You can add helpers to access
|
156
|
+
You can add helpers to access the current R18n object:
|
157
157
|
|
158
158
|
include R18n::Helpers
|
159
159
|
|
@@ -163,12 +163,13 @@ You can add helpers to access to current I18n object:
|
|
163
163
|
|
164
164
|
=== Translation
|
165
165
|
|
166
|
-
Translation files
|
167
|
-
en-us.yml (USA English dialect) with language/country code (RFC
|
166
|
+
Translation files are in YAML format by default and have names like en.yml
|
167
|
+
(English) or en-us.yml (USA English dialect) with language/country code (RFC
|
168
|
+
3066).
|
168
169
|
|
169
|
-
In translation you can use:
|
170
|
+
In your translation files you can use:
|
170
171
|
* Strings
|
171
|
-
robot: This is robot
|
172
|
+
robot: This is a robot
|
172
173
|
percent: "Percent sign (%)"
|
173
174
|
* Numbers
|
174
175
|
number: 123
|
@@ -180,62 +181,62 @@ In translation you can use:
|
|
180
181
|
n: %1 robots
|
181
182
|
* Filters
|
182
183
|
filtered: !!custom_type
|
183
|
-
This content will be processed by filter
|
184
|
+
This content will be processed by a filter
|
184
185
|
|
185
|
-
To get translated string use method with key name or square brackets
|
186
|
-
keys, which is same with Object methods (+class+, +inspect+, etc):
|
186
|
+
To get the translated string use a method with the key name or square brackets
|
187
|
+
[] for keys, which is the same with Object methods (+class+, +inspect+, etc):
|
187
188
|
|
188
|
-
t.robot #=> "This is robot"
|
189
|
-
t[:robot] #=> "This is robot"
|
189
|
+
t.robot #=> "This is a robot"
|
190
|
+
t[:robot] #=> "This is a robot"
|
190
191
|
|
191
192
|
Translation may be hierarchical:
|
192
193
|
|
193
194
|
t.post.add #=> "Add post"
|
194
195
|
t[:post][:add] #=> "Add post"
|
195
196
|
|
196
|
-
If locale
|
197
|
-
or in another locale, which user
|
197
|
+
If the locale isn’t found in the user’s requested locale, R18n will search for
|
198
|
+
it in sublocales or in another locale, which the user also can accept:
|
198
199
|
|
199
|
-
t.
|
200
|
+
t.not.in.english #=> "В английском нет"
|
200
201
|
|
201
|
-
|
202
|
-
or code string if locale is’t supported in R18n):
|
202
|
+
The translated string has a +locale+ method for determining its locale (Locale
|
203
|
+
instance or code string if locale is’t supported in R18n):
|
203
204
|
|
204
|
-
i18n.
|
205
|
+
i18n.not.in.english.locale #=> Locale ru (Русский)
|
205
206
|
|
206
|
-
You can
|
207
|
+
You can include parameters in the translated string by specifying arguments:
|
207
208
|
|
208
209
|
name: "My name is %1"
|
209
210
|
|
210
211
|
t.name('John') #=> "My name is John"
|
211
212
|
|
212
|
-
Pluralizable messages get item count from first argument:
|
213
|
+
Pluralizable messages get their item count from the first argument:
|
213
214
|
|
214
215
|
t.robots(0) #=> "No robots"
|
215
216
|
t.robots(1) #=> "One robot"
|
216
217
|
t.robots(50) #=> "50 robots"
|
217
218
|
|
218
|
-
If there isn’t pluralization for
|
219
|
-
there isn’t locale file for translation, it will
|
220
|
-
rule (0, 1 and +n+).
|
219
|
+
If there isn’t a pluralization for a particular number, translation will be use
|
220
|
+
+n+. If there isn’t a locale file for translation, it will use the English
|
221
|
+
pluralization rule (0, 1 and +n+).
|
221
222
|
|
222
|
-
You can check
|
223
|
+
You can check if the key has a translation:
|
223
224
|
|
224
225
|
t.post.add.translated? #=> true
|
225
226
|
t.not.exists.translated? #=> false
|
226
227
|
|
227
|
-
|
228
|
+
You can set a default value for untranslated strings:
|
228
229
|
|
229
230
|
t.not.exists | 'default' #=> "default"
|
230
231
|
|
231
|
-
You can
|
232
|
+
You can query the translation keys:
|
232
233
|
|
233
234
|
t.counties._keys.each do |county|
|
234
235
|
puts t.counties[county]
|
235
236
|
end
|
236
237
|
|
237
|
-
R18n already has
|
238
|
-
See <tt>base/</tt>
|
238
|
+
R18n already has translations for common words for most built in locales.
|
239
|
+
See <tt>base/</tt> the source.
|
239
240
|
|
240
241
|
t.yes #=> "Yes"
|
241
242
|
t.cancel #=> "Cancel"
|
@@ -243,28 +244,45 @@ See <tt>base/</tt> in dir in gem.
|
|
243
244
|
|
244
245
|
=== Filters
|
245
246
|
|
246
|
-
You can also add you own
|
247
|
-
from Markdown syntax, etc. Filters can be passive
|
248
|
-
|
247
|
+
You can also add you own filters for translations: escape HTML entities, convert
|
248
|
+
from Markdown syntax, etc. Filters can be passive, only being processed when
|
249
|
+
loaded.
|
249
250
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
R18n::Filters.add('custom_type', :passive => true) do |content, config|
|
254
|
-
content + '!'
|
255
|
-
end
|
251
|
+
friendship: !!gender
|
252
|
+
f: She adds a friend
|
253
|
+
m: He adds a friend
|
256
254
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
255
|
+
R18n::Filters.add('gender', :user_gender) do |content, config, user|
|
256
|
+
if user.female?
|
257
|
+
content['f']
|
258
|
+
else
|
259
|
+
content['m']
|
260
|
+
end
|
263
261
|
end
|
262
|
+
|
263
|
+
t.friendship(anne) #=> "She adds a friend"
|
264
|
+
|
265
|
+
To create a filter you pass the following to <tt>R18n::Filters.add</tt>:
|
266
|
+
|
267
|
+
* Filter target. YAML type (<tt>!!type</tt>), <tt>String</tt> for all
|
268
|
+
translations of <tt>R18n::Untranslated</tt> for missing translations.
|
269
|
+
* Optional filter name, to disable, enable or delete it later by
|
270
|
+
<tt>R18n::Filters.off</tt>, <tt>R18n::Filters.on</tt> and
|
271
|
+
<tt>R18n::Filters.delete</tt>.
|
272
|
+
* Hash with options:
|
273
|
+
* <tt>:passive => true</tt> to filter translations only on load;
|
274
|
+
* <tt>:position</tt> within the list of current filters of this type
|
275
|
+
(by default a new filter will be inserted into last position).
|
276
|
+
|
277
|
+
The filter will receive at least two arguments:
|
278
|
+
* Translation (possibly already filtered by other filters for this type earlier
|
279
|
+
in the list).
|
280
|
+
* A Hash with translation +locale+ and +path+.
|
281
|
+
* Parameters from translation request will be in the remaining arguments.
|
264
282
|
|
265
283
|
==== HTML Escape
|
266
284
|
|
267
|
-
R18n
|
285
|
+
R18n contains 2 filters to escape HTML entities: by YAML type and global. If you
|
268
286
|
need to escape HTML in some translations, just set <tt>!!escape</tt> YAML type:
|
269
287
|
|
270
288
|
greater: !!escape
|
@@ -273,12 +291,12 @@ need to escape HTML in some translations, just set <tt>!!escape</tt> YAML type:
|
|
273
291
|
t.greater #=> "1 < 2 is true"
|
274
292
|
|
275
293
|
If you develop web application and want to escape HTML in all translations, just
|
276
|
-
activate global escape filter:
|
294
|
+
activate the global escape filter:
|
277
295
|
|
278
296
|
R18n::Filters.on(:global_escape_html)
|
279
297
|
|
280
|
-
If you enable global HTML escape, you may use <tt>!!html</tt> YAML type to
|
281
|
-
disable escaping
|
298
|
+
If you enable global HTML escape, you may still use <tt>!!html</tt> YAML type to
|
299
|
+
disable escaping on some values:
|
282
300
|
|
283
301
|
warning: !!html
|
284
302
|
<b>Warning</b>
|
@@ -288,7 +306,7 @@ disable escaping in some special value.
|
|
288
306
|
|
289
307
|
==== Markdown
|
290
308
|
|
291
|
-
To use Markdown in your translations you must install
|
309
|
+
To use Markdown in your translations you must install the Maruku gem:
|
292
310
|
|
293
311
|
hi: !!markdown
|
294
312
|
**Hi**, people!
|
@@ -298,7 +316,7 @@ To use Markdown in your translations you must install maruku gem:
|
|
298
316
|
|
299
317
|
==== Textile
|
300
318
|
|
301
|
-
To use Textile in your translations you must install RedCloth gem:
|
319
|
+
To use Textile in your translations you must install the RedCloth gem:
|
302
320
|
|
303
321
|
alarm: !!textile
|
304
322
|
It will delete _all_ users!
|
@@ -313,27 +331,27 @@ You can use lambdas in your translations.
|
|
313
331
|
|
314
332
|
t.sum(1, 2) #=> 3
|
315
333
|
|
316
|
-
If
|
334
|
+
If this is unsafe in your application (for example, user can change
|
317
335
|
translations), you can disable it:
|
318
336
|
|
319
337
|
R18n::Filters.off(:procedure)
|
320
338
|
|
321
339
|
=== Localization
|
322
340
|
|
323
|
-
You can print
|
341
|
+
You can print numbers and floats according to the rules of the user locale:
|
324
342
|
|
325
343
|
l -12000.5 #=> "−12,000.5"
|
326
344
|
|
327
345
|
Number and float formatters will also put real typographic minus and put
|
328
|
-
non-
|
346
|
+
non-breakable thin spaces (for locale, which use it as digit separator).
|
329
347
|
|
330
|
-
You can translate months and week
|
348
|
+
You can translate months and week day names in Time, Date and DateTime by the
|
331
349
|
+strftime+ method:
|
332
350
|
|
333
351
|
l Time.now, '%B' #=> "September"
|
334
352
|
|
335
|
-
R18n has some time formats for locales: <tt>:human</tt>, <tt>:full</tt>
|
336
|
-
<tt>:standard</tt> (
|
353
|
+
R18n has some built-in time formats for locales: <tt>:human</tt>, <tt>:full</tt>
|
354
|
+
and <tt>:standard</tt> (the default):
|
337
355
|
|
338
356
|
l Time.now, :human #=> "now"
|
339
357
|
l Time.now, :full #=> "August 9th, 2009 21:47"
|
@@ -355,13 +373,13 @@ You can add i18n support to any classes, including ORM models:
|
|
355
373
|
translations :title
|
356
374
|
end
|
357
375
|
|
358
|
-
# For example, user
|
376
|
+
# For example, user only knows Russian
|
359
377
|
|
360
|
-
# Set
|
378
|
+
# Set English (default) title
|
361
379
|
product.title_en = "Anthrax"
|
362
380
|
product.title #=> "Anthrax"
|
363
381
|
|
364
|
-
# Set value
|
382
|
+
# Set value for user locale (Russian)
|
365
383
|
product.title = "Сибирская язва"
|
366
384
|
product.title #=> "Сибирская язва"
|
367
385
|
|
@@ -372,14 +390,16 @@ See R18n::Translated for documentation.
|
|
372
390
|
|
373
391
|
=== Locale
|
374
392
|
|
375
|
-
All supported locales are
|
376
|
-
add your locale, please
|
393
|
+
All supported locales are stored in R18n gem in +locales+ directory. If you want
|
394
|
+
to add your locale, please fork this project and send a pull request or email me
|
395
|
+
at andrey@sitnik.ru.
|
377
396
|
|
378
|
-
To get information about locale create R18n::Locale instance:
|
397
|
+
To get information about a locale create an R18n::Locale instance:
|
379
398
|
|
380
399
|
locale = R18n::Locale.load('en')
|
381
400
|
|
382
|
-
You can get from locale:
|
401
|
+
You can then get the following from the locale:
|
402
|
+
|
383
403
|
* Locale title and RFC 3066 code:
|
384
404
|
|
385
405
|
locale.title #=> "English"
|
@@ -395,24 +415,26 @@ You can get from locale:
|
|
395
415
|
|
396
416
|
=== Loaders
|
397
417
|
|
398
|
-
You can load translations from
|
418
|
+
You can load translations from anywhere, not just from YAML files. To load
|
399
419
|
translation you must create loader class with 2 methods:
|
420
|
+
|
400
421
|
* <tt>available</tt> – return array of locales of available translations;
|
401
422
|
* <tt>load(locale)</tt> – return Hash of translation.
|
402
|
-
|
423
|
+
|
424
|
+
Pass its instance to <tt>R18n::I18n.new</tt>:
|
403
425
|
|
404
426
|
R18n.set R18n::I18n.new('en', MyLoader.new(loader_param))
|
405
427
|
|
406
|
-
You can set your loader
|
407
|
-
constructor argument:
|
428
|
+
You can set your default loader and pass it to <tt>R18n::I18n.new</tt> as the
|
429
|
+
only constructor argument:
|
408
430
|
|
409
431
|
R18n.default_loader = MyLoader
|
410
432
|
R18n.set R18n::I18n.new('en', loader_param)
|
411
433
|
|
412
|
-
If you want to load translation with some type for filter, use
|
434
|
+
If you want to load a translation with some type for filter, use
|
413
435
|
<tt>R18n::Typed</tt> struct:
|
414
436
|
|
415
|
-
# Loader
|
437
|
+
# Loader will return something like:
|
416
438
|
{ 'users' => R18n::Typed.new('pl', { 1 => '1 user', 'n' => '%1 users' }) }
|
417
439
|
|
418
440
|
# To use pluralization filter (+pl+ type):
|
@@ -422,34 +444,36 @@ If you want to load translation with some type for filter, use
|
|
422
444
|
|
423
445
|
For r18n plugin you can add loaders with translations, which will be used with
|
424
446
|
application translations. For example, DB plugin may place translations for
|
425
|
-
error messages in extension
|
426
|
-
extension
|
447
|
+
error messages in extension directory. R18n contain translations for base words
|
448
|
+
as extension directory too.
|
427
449
|
|
428
450
|
R18n.extension_places << R18n::Loader::YAML.new('./error_messages/')
|
429
451
|
|
430
452
|
== Add Locale
|
431
453
|
|
432
|
-
If R18n hasn’t locale file for your language, please add it. It’s very
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
454
|
+
If R18n hasn’t got locale file for your language, please add it. It’s very
|
455
|
+
simple:
|
456
|
+
|
457
|
+
* Create the file _code_.rb in the locales/ directory for your language and
|
458
|
+
describe locale. Just copy from another locale and change the values.
|
459
|
+
* If your country has alternate languages (for example, in exUSSR countries
|
460
|
+
most people also know Russian), add
|
437
461
|
<tt>sublocales %{_another_locale_ en}</tt>.
|
438
|
-
* Create in base/ file _code_.yml for your language and translate base
|
439
|
-
Just copy file from language, which you know, and rewrite values.
|
440
|
-
* If
|
441
|
-
or time formatters) you can extend Locale class methods.
|
442
|
-
*
|
443
|
-
|
462
|
+
* Create in base/ file _code_.yml for your language and translate the base
|
463
|
+
messages. Just copy file from language, which you know, and rewrite values.
|
464
|
+
* If your language needs some special logic (for example, different
|
465
|
+
pluralization or time formatters) you can extend Locale class methods.
|
466
|
+
* Send a pull request via GitHub (http://github.com/ai/r18n) or just write email
|
467
|
+
with the files to me (andrey@sitnik.ru).
|
444
468
|
|
445
469
|
_Code_ is RFC 3066 code for your language (for example, “en” for English and
|
446
|
-
“fr-CA” for Canadian French).
|
447
|
-
|
470
|
+
“fr-CA” for Canadian French). Email me with any questions you may have, you will
|
471
|
+
find other contact addresses at http://sitnik.ru.
|
448
472
|
|
449
473
|
== License
|
450
474
|
|
451
475
|
R18n is licensed under the GNU Lesser General Public License version 3.
|
452
|
-
|
476
|
+
See the LICENSE file or http://www.gnu.org/licenses/lgpl.html.
|
453
477
|
|
454
478
|
== Author
|
455
479
|
|
data/base/ca.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
ok: "D'acord"
|
2
|
+
save: Desar
|
3
|
+
cancel: Cancel·lar
|
4
|
+
'yes': 'Sí'
|
5
|
+
'no': 'No'
|
6
|
+
exit: Sortir
|
7
|
+
delete: Esborrar
|
8
|
+
|
9
|
+
human_time:
|
10
|
+
after_days: !!pl
|
11
|
+
1: %1 dia després
|
12
|
+
n: %1 dies després
|
13
|
+
tomorrow: demà
|
14
|
+
after_hours: !!pl
|
15
|
+
1: %1 hora després
|
16
|
+
n: %1 hores després
|
17
|
+
after_minutes: !!pl
|
18
|
+
1: %1 minut després
|
19
|
+
n: %1 minuts després
|
20
|
+
now: ara
|
21
|
+
today: avui
|
22
|
+
minutes_ago: !!pl
|
23
|
+
1: fa %1 minut
|
24
|
+
n: fa %1 minuts
|
25
|
+
hours_ago: !!pl
|
26
|
+
1: fa %1 hora
|
27
|
+
n: fa %1 hores
|
28
|
+
yesterday: ahir
|
29
|
+
days_ago: !!pl
|
30
|
+
1: fa %1 dia
|
31
|
+
n: fa %1 dies
|
data/base/de.yml
CHANGED
@@ -20,12 +20,12 @@ human_time:
|
|
20
20
|
now: jetzt
|
21
21
|
today: heute
|
22
22
|
minutes_ago: !!pl
|
23
|
-
1: %1 Minute
|
24
|
-
n: %1 Minuten
|
23
|
+
1: vor %1 Minute
|
24
|
+
n: vor %1 Minuten
|
25
25
|
hours_ago: !!pl
|
26
|
-
1: %1 Stunde
|
27
|
-
n: %1 Stunden
|
26
|
+
1: vor %1 Stunde
|
27
|
+
n: vor %1 Stunden
|
28
28
|
yesterday: gestern
|
29
29
|
days_ago: !!pl
|
30
|
-
1: %1 Tag
|
31
|
-
n: %1 Tagen
|
30
|
+
1: vor %1 Tag
|
31
|
+
n: vor %1 Tagen
|
data/base/fi.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
ok: OK
|
2
|
+
save: Tallenna
|
3
|
+
cancel: Peru
|
4
|
+
'yes': Kyllä
|
5
|
+
'no': Ei
|
6
|
+
exit: Poistu
|
7
|
+
delete: Poista
|
8
|
+
|
9
|
+
human_time:
|
10
|
+
after_days: !!pl
|
11
|
+
1: yhden päivän kuluttua
|
12
|
+
n: %1 päivän kuluttua
|
13
|
+
tomorrow: huomenna
|
14
|
+
after_hours: !!pl
|
15
|
+
1: yhden tunnin kuluttua
|
16
|
+
n: %1 tunnin kuluttua
|
17
|
+
after_minutes: !!pl
|
18
|
+
1: yhden minuutin kuluttua
|
19
|
+
n: %1 minuutin kuluttua
|
20
|
+
now: nyt
|
21
|
+
today: tänään
|
22
|
+
minutes_ago: !!pl
|
23
|
+
1: minuutti sitten
|
24
|
+
n: %1 minuuttia sitten
|
25
|
+
hours_ago: !!pl
|
26
|
+
1: tunti sitten
|
27
|
+
n: %1 tuntia sitten
|
28
|
+
yesterday: eilen
|
29
|
+
days_ago: !!pl
|
30
|
+
1: päivä sitten
|
31
|
+
n: %1 päivää sitten
|
data/base/fr.yml
CHANGED
@@ -3,12 +3,12 @@ save: Enregistrer
|
|
3
3
|
cancel: Annuler
|
4
4
|
'yes': Oui
|
5
5
|
'no': Non
|
6
|
-
exit:
|
6
|
+
exit: Partir
|
7
7
|
delete: Supprimer
|
8
8
|
|
9
9
|
human_time:
|
10
10
|
after_days: !!pl
|
11
|
-
1: dans
|
11
|
+
1: dans un jour
|
12
12
|
n: dans %1 jours
|
13
13
|
tomorrow: demain
|
14
14
|
after_hours: !!pl
|
@@ -20,12 +20,12 @@ human_time:
|
|
20
20
|
now: maintenant
|
21
21
|
today: "aujourd'hui"
|
22
22
|
minutes_ago: !!pl
|
23
|
-
1: il
|
24
|
-
n: il
|
23
|
+
1: il y a une minute
|
24
|
+
n: il y a %1 minutes
|
25
25
|
hours_ago: !!pl
|
26
|
-
1: il
|
27
|
-
n: il
|
26
|
+
1: il y a une heure
|
27
|
+
n: il y a %1 heures
|
28
28
|
yesterday: hier
|
29
29
|
days_ago: !!pl
|
30
|
-
1: il
|
31
|
-
n: il
|
30
|
+
1: il y a un jour
|
31
|
+
n: il y a %1 jours
|
data/base/lv.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
ok: Ok
|
2
|
+
save: Saglabāt
|
3
|
+
cancel: Atcelt
|
4
|
+
'yes': 'Jā'
|
5
|
+
'no': 'Nē'
|
6
|
+
exit: Iziet
|
7
|
+
delete: Dzēst
|
8
|
+
|
9
|
+
human_time:
|
10
|
+
after_days: !!pl
|
11
|
+
1: nākamajā dienā
|
12
|
+
n: pēc %1 dienām
|
13
|
+
tomorrow: rīt
|
14
|
+
after_hours: !!pl
|
15
|
+
1: nākamajā stundā
|
16
|
+
n: pēc %1 stundas
|
17
|
+
after_minutes: !!pl
|
18
|
+
1: nākamajā minūtē
|
19
|
+
n: pēc %1 minūtēm
|
20
|
+
now: tagad
|
21
|
+
today: šodien
|
22
|
+
minutes_ago: !!pl
|
23
|
+
1: pirms minūtes
|
24
|
+
n: pirms %1 minūtēm
|
25
|
+
hours_ago: !!pl
|
26
|
+
1: pirms stundas
|
27
|
+
n: pirms %1 stundām
|
28
|
+
yesterday: vakar
|
29
|
+
days_ago: !!pl
|
30
|
+
1: pirms vienas dienas
|
31
|
+
n: pirms %1 stundām
|
data/lib/r18n-core/version.rb
CHANGED
data/locales/ca.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module R18n
|
3
|
+
class Locales::Ca < Locale
|
4
|
+
set :title => 'Català',
|
5
|
+
|
6
|
+
:wday_names => %w{diumenge dilluns dimarts dimecres dijous divendres dissabte},
|
7
|
+
:wday_abbrs => %w{dg dl dm dc dj dv ds},
|
8
|
+
|
9
|
+
:month_names => %w{Gener Febrer Març Abril Maig Juny Juliol Agost
|
10
|
+
Setembre Octubre Novembre Desembre},
|
11
|
+
:month_abbrs => %w{gen feb mar abr mai jun jul ago set oct nov des},
|
12
|
+
|
13
|
+
:date_format => '%d/%m/%Y',
|
14
|
+
:full_format => '%d de %B',
|
15
|
+
:year_format => '_ de %Y',
|
16
|
+
|
17
|
+
:number_decimal => ",",
|
18
|
+
:number_group => "."
|
19
|
+
end
|
20
|
+
end
|
data/locales/de.rb
CHANGED
@@ -9,11 +9,13 @@ module R18n
|
|
9
9
|
|
10
10
|
:month_names => %w{Januar Februar März April Mai Juni Juli August
|
11
11
|
September Oktober November Dezember},
|
12
|
-
:month_abbrs => %w{Jan Feb Mär Apr Mai Jun Jul Aug Sep Okt
|
12
|
+
:month_abbrs => %w{Jan. Feb. Mär. Apr. Mai. Jun. Jul. Aug. Sep. Okt.
|
13
|
+
Nov. Dez.},
|
13
14
|
|
14
15
|
:time_am => 'vormittags',
|
15
16
|
:time_pm => 'nachmittags',
|
16
17
|
:date_format => '%d.%m.%Y',
|
18
|
+
:full_format => '%e. %B',
|
17
19
|
|
18
20
|
:number_decimal => ",",
|
19
21
|
:number_group => "."
|
data/locales/en-gb.rb
ADDED
data/locales/en-us.rb
CHANGED
data/locales/eo.rb
CHANGED
@@ -4,7 +4,7 @@ module R18n
|
|
4
4
|
set :title => 'Esperanto',
|
5
5
|
|
6
6
|
:wday_names => %w{dimanĉo lundo mardo merkredo ĵaŭdo vendredo sabato},
|
7
|
-
:wday_abbrs => %w{dim lun mar mer ĵaŭ ven
|
7
|
+
:wday_abbrs => %w{dim lun mar mer ĵaŭ ven sab},
|
8
8
|
|
9
9
|
:month_names => %w{januaro februaro marto aprilo majo junio julio
|
10
10
|
aŭgusto septembro oktobro novembro decembro},
|
data/locales/es.rb
CHANGED
@@ -4,7 +4,7 @@ module R18n
|
|
4
4
|
set :title => 'Español',
|
5
5
|
|
6
6
|
:wday_names => %w{domingo lunes martes miércoles jueves viernes sábado},
|
7
|
-
:wday_abbrs => %w{dom lun mar mie jue
|
7
|
+
:wday_abbrs => %w{dom lun mar mie jue vie sab},
|
8
8
|
|
9
9
|
:month_names => %w{Enero Febrero Marzo Abril Mayo Junio Julio Agosto
|
10
10
|
Septiembre Octubre Noviembre Diciembre},
|
data/locales/fi.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module R18n
|
3
|
+
class Locales::Fi < Locale
|
4
|
+
set :title => 'Suomi',
|
5
|
+
|
6
|
+
:wday_names => %w{sunnuntai maanantai tiistai keskiviikko torstai
|
7
|
+
terjantai lauantai},
|
8
|
+
:wday_abbrs => %w{su ma ti ke to te la},
|
9
|
+
|
10
|
+
:month_names => %w{tammikuuta helmikuuta maaliskuuta huhtikuuta
|
11
|
+
toukokuuta kesäkuuta heinäkuuta elokuuta syyskuuta
|
12
|
+
lokakuuta marraskuuta joulukuuta},
|
13
|
+
:month_abbrs => %w{tam hel maa huh tou kes hei elo syy lok mar jou},
|
14
|
+
:month_standalone => %w{tammikuu helmikuu maaliskuu huhtikuu toukokuu
|
15
|
+
kesäkuu heinäkuu elokuu syyskuu lokakuu
|
16
|
+
marraskuu joulukuu},
|
17
|
+
|
18
|
+
:date_format => '%d.%m.%Y',
|
19
|
+
:time_format => ' %H.%M',
|
20
|
+
:full_format => '%e. %B',
|
21
|
+
|
22
|
+
:number_decimal => ",",
|
23
|
+
:number_group => " "
|
24
|
+
|
25
|
+
def format_time_full(time, *params)
|
26
|
+
format_date_full(time) + ' kello' + format_time(time)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/locales/lv.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module R18n
|
3
|
+
class Locales::Lv < Locale
|
4
|
+
set :title => 'Latviešu',
|
5
|
+
|
6
|
+
:wday_names => %w{Svētdiena Pirmdiena Otrdiena Trešdiena Ceturtdiena
|
7
|
+
Piektiena Sestdiena},
|
8
|
+
:wday_abbrs => %w{Sv P O T C P S},
|
9
|
+
|
10
|
+
:month_names => %w{janvāris februāris marts aprīlis maijs jūnijs jūlijs
|
11
|
+
augusts septembris oktobris novembris decembris},
|
12
|
+
:month_abbrs => %w{jan feb mar apr mai jūn jūl aug sep okt nov dec},
|
13
|
+
:month_standalone => %w{Janvāris Februāris Marts Aprīlis Maijs Jūnijs
|
14
|
+
Jūlijs Augusts Septembris Oktobris Novembris
|
15
|
+
Decembris},
|
16
|
+
|
17
|
+
:date_format => '%d.%m.%Y',
|
18
|
+
:year_format => '_, %Y',
|
19
|
+
|
20
|
+
:number_decimal => ",",
|
21
|
+
:number_group => " "
|
22
|
+
|
23
|
+
def pluralize(n)
|
24
|
+
if 0 == n
|
25
|
+
0
|
26
|
+
elsif 1 == n % 10 and 11 != n % 100
|
27
|
+
1
|
28
|
+
else
|
29
|
+
'n'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/locales/pl.rb
CHANGED
@@ -14,11 +14,11 @@ module R18n
|
|
14
14
|
sierpień wrzesień październik listopad
|
15
15
|
grudzień},
|
16
16
|
|
17
|
-
:date_format => '%d
|
17
|
+
:date_format => '%d.%m.%Y',
|
18
18
|
|
19
19
|
:number_decimal => ",",
|
20
20
|
:number_group => " "
|
21
|
-
|
21
|
+
|
22
22
|
def pluralize(n)
|
23
23
|
return 0 if n == 0
|
24
24
|
case n % 10
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 6
|
9
|
+
version: 0.4.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrey "A.I." Sitnik
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-22 00:00:00 +04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -29,48 +29,55 @@ extra_rdoc_files:
|
|
29
29
|
- LICENSE
|
30
30
|
- ChangeLog
|
31
31
|
files:
|
32
|
-
- base/
|
33
|
-
- base/
|
34
|
-
- base/
|
32
|
+
- base/th.yml
|
33
|
+
- base/zh.yml
|
34
|
+
- base/eo.yml
|
35
35
|
- base/pl.yml
|
36
36
|
- base/sk.yml
|
37
|
+
- base/kk.yml
|
38
|
+
- base/es.yml
|
39
|
+
- base/fi.yml
|
40
|
+
- base/lv.yml
|
37
41
|
- base/de.yml
|
38
|
-
- base/
|
39
|
-
- base/
|
42
|
+
- base/en.yml
|
43
|
+
- base/ca.yml
|
44
|
+
- base/it.yml
|
45
|
+
- base/ru.yml
|
40
46
|
- base/pt_br.yml
|
41
|
-
- base/es.yml
|
42
47
|
- base/fr.yml
|
43
|
-
- base/
|
44
|
-
- base/en.yml
|
45
|
-
- base/zh.yml
|
46
|
-
- lib/r18n-core.rb
|
47
|
-
- lib/r18n-core/filters.rb
|
48
|
-
- lib/r18n-core/untranslated.rb
|
49
|
-
- lib/r18n-core/yaml_loader.rb
|
48
|
+
- base/cs.yml
|
50
49
|
- lib/r18n-core/version.rb
|
51
|
-
- lib/r18n-core/
|
52
|
-
- lib/r18n-core/translated_string.rb
|
53
|
-
- lib/r18n-core/translation.rb
|
50
|
+
- lib/r18n-core/i18n.rb
|
54
51
|
- lib/r18n-core/translated.rb
|
52
|
+
- lib/r18n-core/translation.rb
|
55
53
|
- lib/r18n-core/unsupported_locale.rb
|
56
|
-
- lib/r18n-core/
|
57
|
-
- lib/r18n-core/
|
54
|
+
- lib/r18n-core/yaml_loader.rb
|
55
|
+
- lib/r18n-core/untranslated.rb
|
56
|
+
- lib/r18n-core/translated_string.rb
|
57
|
+
- lib/r18n-core/filters.rb
|
58
58
|
- lib/r18n-core/helpers.rb
|
59
|
-
-
|
59
|
+
- lib/r18n-core/utils.rb
|
60
|
+
- lib/r18n-core/locale.rb
|
61
|
+
- lib/r18n-core.rb
|
60
62
|
- locales/pl.rb
|
61
|
-
- locales/en.rb
|
62
|
-
- locales/cs.rb
|
63
63
|
- locales/es.rb
|
64
|
-
- locales/
|
65
|
-
- locales/
|
66
|
-
- locales/
|
64
|
+
- locales/fi.rb
|
65
|
+
- locales/sk.rb
|
66
|
+
- locales/eo.rb
|
67
|
+
- locales/cs.rb
|
67
68
|
- locales/th.rb
|
69
|
+
- locales/it.rb
|
70
|
+
- locales/en.rb
|
71
|
+
- locales/zh.rb
|
68
72
|
- locales/fr.rb
|
73
|
+
- locales/kk.rb
|
74
|
+
- locales/lv.rb
|
69
75
|
- locales/ru.rb
|
70
|
-
- locales/
|
71
|
-
- locales/
|
76
|
+
- locales/en-us.rb
|
77
|
+
- locales/en-gb.rb
|
72
78
|
- locales/de.rb
|
73
|
-
- locales/
|
79
|
+
- locales/pt-br.rb
|
80
|
+
- locales/ca.rb
|
74
81
|
- LICENSE
|
75
82
|
- ChangeLog
|
76
83
|
- README.rdoc
|
@@ -105,28 +112,28 @@ signing_key:
|
|
105
112
|
specification_version: 3
|
106
113
|
summary: I18n tool to translate your Ruby application.
|
107
114
|
test_files:
|
108
|
-
- spec/translated_spec.rb
|
109
|
-
- spec/locales/it_spec.rb
|
110
|
-
- spec/locales/th_spec.rb
|
111
|
-
- spec/locales/fr_spec.rb
|
112
|
-
- spec/locales/sk_spec.rb
|
113
|
-
- spec/locales/pl_spec.rb
|
114
|
-
- spec/locales/cs_spec.rb
|
115
|
-
- spec/locales/ru_spec.rb
|
116
|
-
- spec/locales/en_spec.rb
|
117
|
-
- spec/locales/en-us_spec.rb
|
118
|
-
- spec/spec_helper.rb
|
119
|
-
- spec/r18n_spec.rb
|
120
115
|
- spec/yaml_loader_spec.rb
|
121
|
-
- spec/translation_spec.rb
|
122
|
-
- spec/translations/general/ru.yml
|
123
|
-
- spec/translations/general/en.yml
|
124
116
|
- spec/translations/general/no-lc.yml
|
125
|
-
- spec/translations/
|
117
|
+
- spec/translations/general/en.yml
|
118
|
+
- spec/translations/general/ru.yml
|
126
119
|
- spec/translations/two/en.yml
|
120
|
+
- spec/translations/two/fr.yml
|
127
121
|
- spec/translations/extension/no-tr.yml
|
128
122
|
- spec/translations/extension/en.yml
|
129
123
|
- spec/translations/extension/deep/en.yml
|
130
|
-
- spec/
|
124
|
+
- spec/spec_helper.rb
|
131
125
|
- spec/i18n_spec.rb
|
126
|
+
- spec/translation_spec.rb
|
127
|
+
- spec/locales/en-us_spec.rb
|
128
|
+
- spec/locales/cs_spec.rb
|
129
|
+
- spec/locales/sk_spec.rb
|
130
|
+
- spec/locales/ru_spec.rb
|
131
|
+
- spec/locales/fr_spec.rb
|
132
|
+
- spec/locales/th_spec.rb
|
133
|
+
- spec/locales/en_spec.rb
|
134
|
+
- spec/locales/it_spec.rb
|
135
|
+
- spec/locales/pl_spec.rb
|
136
|
+
- spec/translated_spec.rb
|
137
|
+
- spec/r18n_spec.rb
|
138
|
+
- spec/filters_spec.rb
|
132
139
|
- spec/locale_spec.rb
|