r18n-core 3.2.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -33
- data/lib/r18n-core.rb +29 -15
- data/lib/r18n-core/filter_list.rb +15 -10
- data/lib/r18n-core/filters.rb +22 -26
- data/lib/r18n-core/helpers.rb +2 -2
- data/lib/r18n-core/i18n.rb +61 -59
- data/lib/r18n-core/locale.rb +120 -97
- data/{locales → lib/r18n-core/locales}/af.rb +12 -8
- data/lib/r18n-core/locales/az.rb +38 -0
- data/lib/r18n-core/locales/bg.rb +29 -0
- data/{locales → lib/r18n-core/locales}/ca.rb +9 -6
- data/{locales → lib/r18n-core/locales}/cs.rb +11 -7
- data/lib/r18n-core/locales/cy.rb +50 -0
- data/{locales → lib/r18n-core/locales}/da.rb +10 -7
- data/lib/r18n-core/locales/de.rb +33 -0
- data/{locales → lib/r18n-core/locales}/en-au.rb +1 -1
- data/{locales → lib/r18n-core/locales}/en-gb.rb +1 -1
- data/{locales → lib/r18n-core/locales}/en-us.rb +2 -1
- data/{locales → lib/r18n-core/locales}/en.rb +8 -5
- data/{locales → lib/r18n-core/locales}/eo.rb +5 -3
- data/lib/r18n-core/locales/es-cl.rb +16 -0
- data/{locales → lib/r18n-core/locales}/es-us.rb +4 -3
- data/{locales → lib/r18n-core/locales}/es.rb +5 -3
- data/{locales → lib/r18n-core/locales}/fa.rb +1 -1
- data/lib/r18n-core/locales/fi.rb +39 -0
- data/{locales → lib/r18n-core/locales}/fr.rb +10 -6
- data/{locales → lib/r18n-core/locales}/gl.rb +5 -3
- data/{locales → lib/r18n-core/locales}/hr.rb +8 -5
- data/{locales → lib/r18n-core/locales}/hu.rb +8 -5
- data/{locales → lib/r18n-core/locales}/id.rb +8 -4
- data/{locales → lib/r18n-core/locales}/it.rb +8 -5
- data/{locales → lib/r18n-core/locales}/ja.rb +4 -3
- data/{locales → lib/r18n-core/locales}/kk.rb +11 -7
- data/{locales → lib/r18n-core/locales}/ko.rb +0 -0
- data/lib/r18n-core/locales/lv.rb +46 -0
- data/lib/r18n-core/locales/mn.rb +30 -0
- data/{locales → lib/r18n-core/locales}/nb.rb +5 -3
- data/{locales → lib/r18n-core/locales}/nl.rb +10 -7
- data/{locales → lib/r18n-core/locales}/no.rb +0 -0
- data/lib/r18n-core/locales/pl.rb +45 -0
- data/{locales → lib/r18n-core/locales}/pt-br.rb +1 -1
- data/lib/r18n-core/locales/pt.rb +35 -0
- data/lib/r18n-core/locales/ru.rb +46 -0
- data/{locales → lib/r18n-core/locales}/sk.rb +10 -6
- data/{locales → lib/r18n-core/locales}/sr-latn.rb +5 -3
- data/{locales → lib/r18n-core/locales}/sv-se.rb +6 -4
- data/lib/r18n-core/locales/th.rb +41 -0
- data/{locales → lib/r18n-core/locales}/tr.rb +5 -4
- data/lib/r18n-core/locales/uk.rb +31 -0
- data/{locales → lib/r18n-core/locales}/vi.rb +11 -7
- data/{locales → lib/r18n-core/locales}/zh-cn.rb +1 -1
- data/{locales → lib/r18n-core/locales}/zh-tw.rb +3 -3
- data/{locales → lib/r18n-core/locales}/zh.rb +4 -3
- data/lib/r18n-core/translated.rb +35 -34
- data/lib/r18n-core/translated_string.rb +4 -2
- data/lib/r18n-core/translation.rb +16 -17
- data/lib/r18n-core/unsupported_locale.rb +6 -5
- data/lib/r18n-core/untranslated.rb +10 -4
- data/lib/r18n-core/utils.rb +1 -14
- data/lib/r18n-core/version.rb +1 -1
- data/lib/r18n-core/yaml_loader.rb +13 -13
- data/lib/r18n-core/yaml_methods.rb +3 -1
- data/r18n-core.gemspec +1 -1
- data/spec/filters_spec.rb +3 -0
- data/spec/i18n_spec.rb +22 -8
- data/spec/locale_spec.rb +4 -5
- data/spec/locales/af_spec.rb +9 -0
- data/spec/locales/en-us_spec.rb +16 -1
- data/spec/locales/es-us_spec.rb +11 -0
- data/spec/locales/fi_spec.rb +9 -0
- data/spec/locales/hu_spec.rb +2 -0
- data/spec/locales/id_spec.rb +23 -0
- data/spec/locales/vi_spec.rb +4 -3
- data/spec/r18n_spec.rb +21 -7
- data/spec/spec_helper.rb +0 -7
- data/spec/translated_spec.rb +121 -65
- data/spec/translation_spec.rb +5 -2
- data/spec/translations/with_regions/en-US.yml +0 -0
- data/spec/translations/yaml/en-GB.yml +1 -0
- data/spec/translations/yaml/en-us.yml +1 -0
- data/spec/yaml_loader_spec.rb +4 -2
- metadata +64 -50
- data/locales/az.rb +0 -34
- data/locales/bg.rb +0 -25
- data/locales/cy.rb +0 -50
- data/locales/de.rb +0 -29
- data/locales/fi.rb +0 -35
- data/locales/lv.rb +0 -41
- data/locales/mn.rb +0 -27
- data/locales/pl.rb +0 -40
- data/locales/pt.rb +0 -29
- data/locales/ru.rb +0 -41
- data/locales/th.rb +0 -37
- data/locales/uk.rb +0 -27
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module R18n
|
4
|
+
module Locales
|
5
|
+
# Russian locale
|
6
|
+
class Ru < Locale
|
7
|
+
set(
|
8
|
+
title: 'Русский',
|
9
|
+
|
10
|
+
wday_names: %w[
|
11
|
+
Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота
|
12
|
+
],
|
13
|
+
wday_abbrs: %w[Вск Пнд Втр Срд Чтв Птн Сбт],
|
14
|
+
|
15
|
+
month_names: %w[
|
16
|
+
января февраля марта апреля мая июня июля августа сентября октября
|
17
|
+
ноября декабря
|
18
|
+
],
|
19
|
+
month_abbrs: %w[янв фев мар апр май июн июл авг сен окт ноя дек],
|
20
|
+
month_standalone: %w[
|
21
|
+
Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь
|
22
|
+
Ноябрь Декабрь
|
23
|
+
],
|
24
|
+
|
25
|
+
time_am: ' утра',
|
26
|
+
time_pm: ' вечера',
|
27
|
+
date_format: '%d.%m.%Y',
|
28
|
+
|
29
|
+
number_decimal: ',',
|
30
|
+
number_group: ' '
|
31
|
+
)
|
32
|
+
|
33
|
+
def pluralize(number)
|
34
|
+
if number.zero?
|
35
|
+
0
|
36
|
+
elsif number % 10 == 1 && number % 100 != 11
|
37
|
+
1
|
38
|
+
elsif (2..4).cover?(number % 10) && !(10..19).cover?(number % 100)
|
39
|
+
2
|
40
|
+
else
|
41
|
+
'n'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -11,11 +11,15 @@ module R18n
|
|
11
11
|
wday_names: %w[Nedeľa Pondelok Utorok Streda Štvrtok Piatok Sobota],
|
12
12
|
wday_abbrs: %w[Ne Po Ut St Št Pi So],
|
13
13
|
|
14
|
-
month_names:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
month_names: %w[
|
15
|
+
januára februára marca apríla mája júna júla augusta septembra
|
16
|
+
októbra novembra decembra
|
17
|
+
],
|
18
|
+
month_abbrs: %w[jan feb mar apr máj jún júl aug sep okt nov dec],
|
19
|
+
month_standalone: %w[
|
20
|
+
Január Február Marec Apríl Máj Jún Júl August September Október
|
21
|
+
November December
|
22
|
+
],
|
19
23
|
|
20
24
|
time_am: 'dop.',
|
21
25
|
time_pm: 'odp.',
|
@@ -23,7 +27,7 @@ module R18n
|
|
23
27
|
full_format: '%-d. %B',
|
24
28
|
|
25
29
|
number_decimal: ',',
|
26
|
-
number_group:
|
30
|
+
number_group: ' '
|
27
31
|
)
|
28
32
|
|
29
33
|
def pluralize(number)
|
@@ -11,15 +11,17 @@ module R18n
|
|
11
11
|
wday_names: %w[nedelja ponedeljak utorak sreda četvrtak petak subota],
|
12
12
|
wday_abbrs: %w[ned pon uto sri čet pet sub],
|
13
13
|
|
14
|
-
month_names: %w[
|
15
|
-
|
14
|
+
month_names: %w[
|
15
|
+
januar februar mart april maj juni juli avgust septembar oktobar
|
16
|
+
novembar decembar
|
17
|
+
],
|
16
18
|
month_abbrs: %w[jan feb mar apr maj jun jul avg sep okt nov dec],
|
17
19
|
|
18
20
|
date_format: '%d.%m.%Y',
|
19
21
|
full_format: '%-d. %B',
|
20
22
|
|
21
23
|
number_decimal: ',',
|
22
|
-
number_group:
|
24
|
+
number_group: '.'
|
23
25
|
|
24
26
|
def pluralize(number)
|
25
27
|
if number.zero?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module R18n
|
4
4
|
module Locales
|
5
5
|
# Swedish (Sweden) locale
|
6
|
-
class
|
6
|
+
class SvSE < Locale
|
7
7
|
set(
|
8
8
|
title: 'Svenska',
|
9
9
|
sublocales: %w[sv en],
|
@@ -11,15 +11,17 @@ module R18n
|
|
11
11
|
wday_names: %w[söndag måndag tisdag onsdag torsdag fredag lördag],
|
12
12
|
wday_abbrs: %w[sön mån tis ons tor fre lör],
|
13
13
|
|
14
|
-
month_names: %w[
|
15
|
-
|
14
|
+
month_names: %w[
|
15
|
+
januari februari mars april maj juni juli augusti september oktober
|
16
|
+
november december
|
17
|
+
],
|
16
18
|
month_abbrs: %w[jan feb mar apr maj jun jul aug okt nov dec],
|
17
19
|
|
18
20
|
date_format: '%Y-%m-%d',
|
19
21
|
full_format: '%-d %B %Y',
|
20
22
|
|
21
23
|
number_decimal: ',',
|
22
|
-
number_group:
|
24
|
+
number_group: '.'
|
23
25
|
)
|
24
26
|
end
|
25
27
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module R18n
|
4
|
+
module Locales
|
5
|
+
# Thai locale
|
6
|
+
class Th < Locale
|
7
|
+
set(
|
8
|
+
title: 'ภาษาไทย',
|
9
|
+
|
10
|
+
wday_names: %w[
|
11
|
+
วันอาทิตย์ วันจันทร์ วันอังคาร วันพุธ วันพฤหัสบดี วันศุกร์ วันเสาร์
|
12
|
+
],
|
13
|
+
wday_abbrs: %w[อาทิตย์ จันทร์ อังคาร พุธ พฤหัสบดี ศุกร์ เสาร์],
|
14
|
+
|
15
|
+
month_names: %w[
|
16
|
+
มกราคม กุมภาพันธ์ มีนาคม เมษายน พฤษภาคม มิถุนายน กรกฎาคม สิงหาคม
|
17
|
+
กันยายน ตุลาคม พฤศจิกายน ธันวาคม
|
18
|
+
],
|
19
|
+
month_abbrs: %w[
|
20
|
+
ม.ค. ก.พ. มี.ค. เม.ย. พ.ค. มิ.ย. ก.ค. ส.ค. ก.ย. ต.ค. พ.ย. ธ.ค.
|
21
|
+
],
|
22
|
+
|
23
|
+
date_format: '%d/%m/%Y',
|
24
|
+
full_format: '%-d %B',
|
25
|
+
year_format: '_, %Y',
|
26
|
+
|
27
|
+
number_decimal: '.',
|
28
|
+
number_group: ','
|
29
|
+
)
|
30
|
+
|
31
|
+
def pluralize(_number)
|
32
|
+
'n'
|
33
|
+
end
|
34
|
+
|
35
|
+
def strftime(time, format)
|
36
|
+
year = (time.year + 543).to_s
|
37
|
+
super(time, format.gsub('%Y', year).gsub('%y', year[-2..-1]))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -10,17 +10,18 @@ module R18n
|
|
10
10
|
wday_names: %w[Pazar Pazartesi Salı Çarşamba Perşembe Cuma Cumartesi],
|
11
11
|
wday_abbrs: %w[Paz Pzt Sal Çar Per Cum Cmt],
|
12
12
|
|
13
|
-
month_names: %w[
|
14
|
-
|
13
|
+
month_names: %w[
|
14
|
+
Ocak Şubat Mart Nisan Mayıs Haziran Temmuz Ağustos Eylül Ekim Kasım
|
15
|
+
Aralık
|
16
|
+
],
|
15
17
|
month_abbrs: %w[Oca Şub Mar Nis May Haz Tem Ağu Eyl Eki Kas Ara],
|
16
18
|
|
17
19
|
date_format: '%d.%m.%Y',
|
18
20
|
full_format: '%B %-d.',
|
19
21
|
year_format: '%Y. _',
|
20
|
-
time_format: '_%H:%M',
|
21
22
|
|
22
23
|
number_decimal: '.',
|
23
|
-
number_group:
|
24
|
+
number_group: ','
|
24
25
|
)
|
25
26
|
|
26
27
|
def pluralize(_number)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'ru'
|
4
|
+
|
5
|
+
module R18n
|
6
|
+
module Locales
|
7
|
+
# Ukrainian locale
|
8
|
+
class Uk < Ru
|
9
|
+
set(
|
10
|
+
title: 'Українська',
|
11
|
+
sublocales: %w[ru en],
|
12
|
+
|
13
|
+
wday_names: %w[Неділя Понеділок Вівторок Середа Четвер П'ятниця Субота],
|
14
|
+
wday_abbrs: %w[Ндл Пнд Втр Срд Чтв Птн Сбт],
|
15
|
+
|
16
|
+
month_names: %w[
|
17
|
+
січня лютого березня квітня травня червня липня серпня вересня жовтня
|
18
|
+
листопада грудня
|
19
|
+
],
|
20
|
+
month_abbrs: %w[січ лют бер кві тра чер лип сер вер жов лис гру],
|
21
|
+
month_standalone: %w[
|
22
|
+
Січень Лютий Березень Квітень Травень Червень Липень Серпень Вересень
|
23
|
+
Жовтень Листопад Грудень
|
24
|
+
],
|
25
|
+
|
26
|
+
time_am: ' ранку',
|
27
|
+
time_pm: ' вечора'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -7,22 +7,26 @@ module R18n
|
|
7
7
|
set(
|
8
8
|
title: 'Tiếng Việt',
|
9
9
|
|
10
|
-
wday_names: [
|
11
|
-
|
10
|
+
wday_names: [
|
11
|
+
'Chủ nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu',
|
12
|
+
'Thứ Bảy'
|
13
|
+
],
|
12
14
|
wday_abbrs: %w[CN T2 T3 T4 T5 T6 T7],
|
13
15
|
|
14
|
-
month_names: [
|
15
|
-
|
16
|
-
|
16
|
+
month_names: [
|
17
|
+
'tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6',
|
18
|
+
'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'
|
19
|
+
],
|
17
20
|
month_abbrs: %w[th1 th2 th3 th4 th5 th6 th7 th8 th9 th10 th11 th12],
|
18
21
|
|
19
22
|
date_format: '%d/%m/%Y',
|
20
23
|
full_format: 'ngày %-d %B',
|
21
24
|
year_format: '_ năm %Y',
|
22
|
-
time_format: '%
|
25
|
+
time_format: '%R, _',
|
26
|
+
time_with_seconds_format: '%T, _',
|
23
27
|
|
24
28
|
number_decimal: '.',
|
25
|
-
number_group:
|
29
|
+
number_group: ','
|
26
30
|
)
|
27
31
|
|
28
32
|
def pluralize(_number)
|
@@ -5,13 +5,13 @@ require_relative 'zh'
|
|
5
5
|
module R18n
|
6
6
|
module Locales
|
7
7
|
# Chinese (T) locale
|
8
|
-
class
|
8
|
+
class ZhTW < Zh
|
9
9
|
set(
|
10
10
|
title: '繁體中文',
|
11
11
|
sublocales: %w[zh en],
|
12
12
|
|
13
|
-
wday_names:
|
14
|
-
wday_abbrs:
|
13
|
+
wday_names: %w[星期日 星期壹 星期二 星期三 星期四 星期五 星期六],
|
14
|
+
wday_abbrs: %w[周日 周壹 周二 周三 周四 周五 周六],
|
15
15
|
month_names: %w[壹月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十壹月 十二月]
|
16
16
|
)
|
17
17
|
end
|
@@ -10,15 +10,16 @@ module R18n
|
|
10
10
|
wday_names: %w[星期日 星期一 星期二 星期三 星期四 星期五 星期六],
|
11
11
|
wday_abbrs: %w[周日 周一 周二 周三 周四 周五 周六],
|
12
12
|
|
13
|
-
month_names: %w[
|
14
|
-
|
13
|
+
month_names: %w[
|
14
|
+
一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月
|
15
|
+
],
|
15
16
|
|
16
17
|
date_format: '%Y年%m月%d日',
|
17
18
|
full_format: '%m月%d日',
|
18
19
|
year_format: '%Y年_',
|
19
20
|
|
20
21
|
number_decimal: '.',
|
21
|
-
number_group:
|
22
|
+
number_group: ' '
|
22
23
|
)
|
23
24
|
|
24
25
|
def pluralize(_number)
|
data/lib/r18n-core/translated.rb
CHANGED
@@ -22,9 +22,9 @@ module R18n
|
|
22
22
|
# R18n plugin with out-of-box i18n support.
|
23
23
|
#
|
24
24
|
# Module can add proxy-methods to find translation in object methods. For
|
25
|
-
# example, if you class have
|
26
|
-
# proxy-method
|
27
|
-
#
|
25
|
+
# example, if you class have `title_en` and `title_ru` methods, you can add
|
26
|
+
# proxy-method `title`, which will use `title_ru` for Russian users and
|
27
|
+
# `title_en` for English:
|
28
28
|
#
|
29
29
|
# class Product
|
30
30
|
# include DataMapper::Resource
|
@@ -58,21 +58,21 @@ module R18n
|
|
58
58
|
# Proxy-method support all funtion from I18n: global and type filters,
|
59
59
|
# pluralization, variables. It also return TranslatedString or Untranslated.
|
60
60
|
#
|
61
|
-
# By default it use
|
62
|
-
# before use model), but you can overwrite object
|
61
|
+
# By default it use `R18n.get` to get I18n object (so, you must set it
|
62
|
+
# before use model), but you can overwrite object `r18n` method to change
|
63
63
|
# default logic.
|
64
64
|
#
|
65
65
|
# See R18n::Translated::Base for class method documentation.
|
66
66
|
#
|
67
67
|
# == Options
|
68
68
|
# You can set option for proxy-method as Hash with keys;
|
69
|
-
# *
|
70
|
-
# *
|
71
|
-
# *
|
69
|
+
# * `type` – YAML type for filters. For example, "markdown" or "escape_html".
|
70
|
+
# * `methods` – manual method map as Hash of locale codes to method names.
|
71
|
+
# * `no_params` – set it to true if you proxy-method must send it parameters
|
72
72
|
# only to filters.
|
73
|
-
# *
|
73
|
+
# * `no_write` – set it to true if you don't want to create proxy-setters.
|
74
74
|
#
|
75
|
-
# Method
|
75
|
+
# Method `translation` will be more useful for options:
|
76
76
|
#
|
77
77
|
# translation :title, methods: { ru: :russian, en: :english}
|
78
78
|
module Translated
|
@@ -81,54 +81,54 @@ module R18n
|
|
81
81
|
base.send :extend, Base
|
82
82
|
base.instance_variable_set '@unlocalized_getters', {}
|
83
83
|
base.instance_variable_set '@unlocalized_setters', {}
|
84
|
-
base.instance_variable_set '@translation_types', {}
|
85
84
|
end
|
86
85
|
end
|
87
86
|
|
88
87
|
# Access to I18n object. By default return global I18n object from
|
89
|
-
#
|
88
|
+
# `R18n.get`.
|
90
89
|
def r18n
|
91
90
|
R18n.get
|
92
91
|
end
|
93
92
|
|
94
93
|
# Module with class methods, which be added after R18n::Translated include.
|
95
94
|
module Base
|
96
|
-
# Hash of translation method names to it type for filters.
|
97
|
-
|
95
|
+
# `Hash` of translation method names to it type for filters.
|
96
|
+
def translation_types
|
97
|
+
@translation_types ||= {}
|
98
|
+
end
|
98
99
|
|
99
|
-
# Add several proxy
|
100
|
-
# It
|
100
|
+
# Add several proxy methods. See `R18n::Translated` for description.
|
101
|
+
# It's more compact, that `translation`.
|
101
102
|
#
|
102
103
|
# translations :title, :keywords, [:desciption, { type: 'markdown' }]
|
103
|
-
def translations(*
|
104
|
-
|
105
|
-
translation(*method)
|
106
|
-
end
|
104
|
+
def translations(*names)
|
105
|
+
names.each { |name| translation(*name) }
|
107
106
|
end
|
108
107
|
|
109
|
-
# Add proxy-method
|
110
|
-
# It
|
108
|
+
# Add proxy-method `name`. See `R18n::Translated` for description.
|
109
|
+
# It's more useful to set options.
|
111
110
|
#
|
112
111
|
# translation :desciption, type: 'markdown'
|
113
112
|
def translation(name, options = {})
|
114
113
|
if options[:methods]
|
115
|
-
@unlocalized_getters[name] =
|
116
|
-
|
114
|
+
@unlocalized_getters[name] =
|
115
|
+
options[:methods].map { |l, i| [l.to_s, i.to_s] }.to_h
|
117
116
|
unless options[:no_write]
|
118
|
-
@unlocalized_setters[name] =
|
119
|
-
|
117
|
+
@unlocalized_setters[name] =
|
118
|
+
options[:methods].map { |l, i| [l.to_s, i.to_s + '='] }.to_h
|
120
119
|
end
|
121
120
|
end
|
122
121
|
|
123
|
-
|
122
|
+
translation_types[name] = options[:type]
|
124
123
|
|
125
124
|
define_method name do |*params|
|
126
125
|
unlocalized = self.class.unlocalized_getters(name)
|
127
126
|
result = nil
|
128
127
|
|
129
128
|
r18n.locales.each do |locale|
|
130
|
-
code = locale.
|
129
|
+
code = locale.downcased_code
|
131
130
|
next unless unlocalized.key? code
|
131
|
+
|
132
132
|
result = send(
|
133
133
|
unlocalized[code], *(params unless options[:no_params])
|
134
134
|
)
|
@@ -160,19 +160,20 @@ module R18n
|
|
160
160
|
r18n.locales.each do |locale|
|
161
161
|
code = locale.code
|
162
162
|
next unless unlocalized.key? code
|
163
|
+
|
163
164
|
return send unlocalized[code], *params
|
164
165
|
end
|
165
166
|
end
|
166
167
|
end
|
167
168
|
|
168
|
-
# Return array of methods to find
|
169
|
-
#
|
169
|
+
# Return array of methods to find `unlocalized_getters` or
|
170
|
+
# `unlocalized_setters`.
|
170
171
|
def unlocalized_methods
|
171
172
|
instance_methods
|
172
173
|
end
|
173
174
|
|
174
|
-
# Return Hash of locale code to getter method for proxy
|
175
|
-
# didn
|
175
|
+
# Return `Hash` of locale code to getter method for proxy `method`. If you
|
176
|
+
# didn't set map in `translation` option `methods`, it will be detect
|
176
177
|
# automatically.
|
177
178
|
def unlocalized_getters(method)
|
178
179
|
matcher = Regexp.new('^' + Regexp.escape(method.to_s) + '_(\w+)$')
|
@@ -185,8 +186,8 @@ module R18n
|
|
185
186
|
@unlocalized_getters[method]
|
186
187
|
end
|
187
188
|
|
188
|
-
# Return Hash of locale code to setter method for proxy
|
189
|
-
# didn
|
189
|
+
# Return `Hash` of locale code to setter method for proxy `method`. If you
|
190
|
+
# didn't set map in `translation` option `methods`, it will be detect
|
190
191
|
# automatically.
|
191
192
|
def unlocalized_setters(method)
|
192
193
|
matcher = Regexp.new('^' + Regexp.escape(method.to_s) + '_(\w+)=$')
|