r18n-core 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -1
- data/ChangeLog.md +6 -1
- data/README.md +1 -20
- data/Rakefile +5 -3
- data/lib/r18n-core.rb +55 -55
- data/lib/r18n-core/filter_list.rb +34 -36
- data/lib/r18n-core/filters.rb +68 -51
- data/lib/r18n-core/helpers.rb +17 -17
- data/lib/r18n-core/i18n.rb +46 -39
- data/lib/r18n-core/locale.rb +79 -70
- data/lib/r18n-core/translated.rb +65 -66
- data/lib/r18n-core/translated_string.rb +24 -24
- data/lib/r18n-core/translation.rb +31 -30
- data/lib/r18n-core/unsupported_locale.rb +22 -24
- data/lib/r18n-core/untranslated.rb +35 -33
- data/lib/r18n-core/utils.rb +26 -25
- data/lib/r18n-core/version.rb +4 -1
- data/lib/r18n-core/yaml_loader.rb +26 -25
- data/lib/r18n-core/yaml_methods.rb +25 -28
- data/locales/af.rb +15 -8
- data/locales/az.rb +19 -12
- data/locales/bg.rb +16 -9
- data/locales/ca.rb +16 -9
- data/locales/cs.rb +27 -20
- data/locales/da.rb +15 -8
- data/locales/de.rb +16 -9
- data/locales/en-au.rb +10 -5
- data/locales/en-gb.rb +12 -5
- data/locales/en-us.rb +12 -5
- data/locales/en.rb +29 -22
- data/locales/eo.rb +14 -7
- data/locales/es-us.rb +12 -5
- data/locales/es.rb +14 -7
- data/locales/fa.rb +48 -32
- data/locales/fi.rb +19 -12
- data/locales/fr.rb +22 -15
- data/locales/gl.rb +15 -8
- data/locales/hr.rb +24 -17
- data/locales/hu.rb +28 -21
- data/locales/id.rb +14 -7
- data/locales/it.rb +21 -14
- data/locales/ja.rb +15 -8
- data/locales/kk.rb +17 -10
- data/locales/ko.rb +15 -9
- data/locales/lv.rb +24 -17
- data/locales/mn.rb +10 -3
- data/locales/nb.rb +15 -8
- data/locales/nl.rb +15 -8
- data/locales/no.rb +11 -16
- data/locales/pl.rb +26 -19
- data/locales/pt-br.rb +12 -5
- data/locales/pt.rb +17 -10
- data/locales/ru.rb +26 -19
- data/locales/sk.rb +27 -20
- data/locales/sr-latn.rb +27 -22
- data/locales/sv-se.rb +15 -8
- data/locales/th.rb +27 -20
- data/locales/tr.rb +16 -9
- data/locales/uk.rb +19 -12
- data/locales/vi.rb +14 -7
- data/locales/zh-cn.rb +12 -5
- data/locales/zh-tw.rb +15 -8
- data/locales/zh.rb +14 -7
- data/r18n-core.gemspec +5 -3
- data/spec/filters_spec.rb +71 -67
- data/spec/i18n_spec.rb +73 -51
- data/spec/locale_spec.rb +73 -68
- data/spec/locales/cs_spec.rb +2 -2
- data/spec/locales/en-us_spec.rb +9 -9
- data/spec/locales/en_spec.rb +2 -2
- data/spec/locales/fa_spec.rb +3 -3
- data/spec/locales/fr_spec.rb +2 -2
- data/spec/locales/hu_spec.rb +7 -7
- data/spec/locales/it_spec.rb +3 -3
- data/spec/locales/no_spec.rb +9 -0
- data/spec/locales/pl_spec.rb +2 -2
- data/spec/locales/ru_spec.rb +2 -2
- data/spec/locales/sk_spec.rb +2 -2
- data/spec/locales/th_spec.rb +2 -2
- data/spec/locales/vi_spec.rb +2 -2
- data/spec/r18n_spec.rb +44 -38
- data/spec/spec_helper.rb +13 -9
- data/spec/translated_spec.rb +48 -31
- data/spec/translation_spec.rb +29 -27
- data/spec/translations/general/en.yml +0 -2
- data/spec/yaml_loader_spec.rb +22 -18
- metadata +5 -3
data/locales/fr.rb
CHANGED
@@ -1,27 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# French locale
|
6
|
+
class Fr < Locale
|
7
|
+
set(
|
8
|
+
title: 'Français',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[dimanche lundi mardi mercredi jeudi vendredi samedi],
|
11
|
+
wday_abbrs: %w[dim lun mar mer jeu ven sam],
|
7
12
|
|
8
|
-
month_names: %w
|
9
|
-
septembre octobre novembre décembre
|
10
|
-
month_abbrs: %w
|
11
|
-
month_standalone: %w
|
12
|
-
|
13
|
+
month_names: %w[janvier février mars avril mai juin juillet août
|
14
|
+
septembre octobre novembre décembre],
|
15
|
+
month_abbrs: %w[jan fév mar avr mai jun jui aoû sep oct nov déc],
|
16
|
+
month_standalone: %w[Janvier Février Mars Avril Mai Juin Juillet Août
|
17
|
+
Septembre Octobre Novembre Décembre],
|
13
18
|
|
14
19
|
date_format: '%d/%m/%Y',
|
15
20
|
|
16
21
|
number_decimal: ',',
|
17
22
|
number_group: ' '
|
23
|
+
)
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
def format_date_full(date, year = true, *_params)
|
26
|
+
full = super(date, year)
|
27
|
+
if full[0..1] == ' 1'
|
28
|
+
'1er' + full[2..-1]
|
29
|
+
else
|
30
|
+
full
|
31
|
+
end
|
25
32
|
end
|
26
33
|
end
|
27
34
|
end
|
data/locales/gl.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Galician locale
|
6
|
+
class Gl < Locale
|
7
|
+
set(
|
8
|
+
title: 'Galego',
|
9
|
+
sublocales: %w[es en],
|
5
10
|
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[domingo luns martes mércores xoves venres sábado],
|
12
|
+
wday_abbrs: %w[dom lun mar mér xov ven sáb],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
agosto setembro outubro novembro decembro
|
11
|
-
month_abbrs: %w
|
14
|
+
month_names: %w[xaneiro febreiro marzo abril maio xuño xullo
|
15
|
+
agosto setembro outubro novembro decembro],
|
16
|
+
month_abbrs: %w[xan feb mar abr mai xuñ xul ago set out nov dec],
|
12
17
|
|
13
18
|
date_format: '%d/%m/%Y',
|
14
19
|
full_format: '%d de %B',
|
@@ -16,5 +21,7 @@ module R18n
|
|
16
21
|
|
17
22
|
number_decimal: ',',
|
18
23
|
number_group: '.'
|
24
|
+
)
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
data/locales/hr.rb
CHANGED
@@ -1,31 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Croatian locale
|
6
|
+
class Hr < Locale
|
7
|
+
set(
|
8
|
+
title: 'Hrvatski',
|
4
9
|
|
5
10
|
week_start: :monday,
|
6
|
-
wday_names: %w
|
7
|
-
Subota
|
8
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[Nedjelja Ponedjeljak Utorak Srijeda Četvrtak Petak
|
12
|
+
Subota],
|
13
|
+
wday_abbrs: %w[Ned Pon Uto Sri Čet Pet Sub],
|
9
14
|
|
10
|
-
month_names: %w
|
11
|
-
Kolovoz Rujan Listopad Studeni Prosinac
|
12
|
-
month_abbrs: %w
|
15
|
+
month_names: %w[Siječanj Veljača Ožujak Travanj Svibanj Lipanj Srpanj
|
16
|
+
Kolovoz Rujan Listopad Studeni Prosinac],
|
17
|
+
month_abbrs: %w[Sij Velj Ožu Tra Svi Lip Srp Kol Ruj Lis Stu Pro],
|
13
18
|
|
14
19
|
date_format: '%d.%m.%Y',
|
15
20
|
full_format: '%e. %B',
|
16
21
|
|
17
22
|
number_decimal: ',',
|
18
23
|
number_group: '.'
|
24
|
+
)
|
19
25
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def pluralize(n)
|
27
|
+
if n.zero?
|
28
|
+
0
|
29
|
+
elsif n == 1
|
30
|
+
1
|
31
|
+
elsif n >= 2 && n <= 4
|
32
|
+
2
|
33
|
+
else
|
34
|
+
'n'
|
35
|
+
end
|
29
36
|
end
|
30
37
|
end
|
31
38
|
end
|
data/locales/hu.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Hungarian locale
|
6
|
+
class Hu < Locale
|
7
|
+
set(
|
8
|
+
title: 'Magyar',
|
4
9
|
|
5
10
|
week_start: :monday,
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[vasárnap hétfő kedd szerda csütörtök péntek szombat],
|
12
|
+
wday_abbrs: %w[vas hét ked sze csü pén szo],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
augusztus szeptember október november december
|
11
|
-
month_abbrs: %w
|
14
|
+
month_names: %w[január február március április május június július
|
15
|
+
augusztus szeptember október november december],
|
16
|
+
month_abbrs: %w[jan feb már ápr máj jún júl aug sze okt nov dec],
|
12
17
|
|
13
18
|
date_format: '%Y. %m. %d.',
|
14
19
|
full_format: '%B %e.',
|
@@ -17,24 +22,26 @@ module R18n
|
|
17
22
|
|
18
23
|
number_decimal: ',',
|
19
24
|
number_group: ' '
|
25
|
+
)
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
def pluralize(_n)
|
28
|
+
'n'
|
29
|
+
end
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
def format_integer(integer)
|
32
|
+
str = integer.to_s
|
33
|
+
str[0] = '−' if integer < 0 # Real typographic minus
|
34
|
+
group = number_group
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
# only group numbers if it has at least 5 digits
|
37
|
+
# http://hu.wikisource.org/wiki/A_magyar_helyes%C3%ADr%C3%A1s_szab%C3%A1lyai/Az_%C3%ADr%C3%A1sjelek#274.
|
38
|
+
if integer.abs >= 10_000
|
39
|
+
str.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) do |match|
|
40
|
+
match + group
|
41
|
+
end
|
42
|
+
else
|
43
|
+
str
|
35
44
|
end
|
36
|
-
else
|
37
|
-
str
|
38
45
|
end
|
39
46
|
end
|
40
47
|
end
|
data/locales/id.rb
CHANGED
@@ -1,17 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Indonesian locale
|
6
|
+
class Id < Locale
|
7
|
+
set(
|
8
|
+
title: 'Bahasa Indonesia',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[Minggu Senin Selasa Rabu Kamis Jumat Sabtu],
|
11
|
+
wday_abbrs: %w[Min Sen Sel Rab Kam Jum Sab],
|
7
12
|
|
8
|
-
month_names: %w
|
9
|
-
September Oktober Nopember Desember
|
10
|
-
month_abbrs: %w
|
13
|
+
month_names: %w[Januari Februari Maret April Mei Juni Juli Agustus
|
14
|
+
September Oktober Nopember Desember],
|
15
|
+
month_abbrs: %w[Jan Feb Mar Apr Mei Jun Jul Agu Sep Okt Nop Des],
|
11
16
|
|
12
17
|
date_format: '%d/%m/%Y',
|
13
18
|
|
14
19
|
number_decimal: ',',
|
15
20
|
number_group: '.'
|
21
|
+
)
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
data/locales/it.rb
CHANGED
@@ -1,26 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Italian locale
|
6
|
+
class It < Locale
|
7
|
+
set(
|
8
|
+
title: 'Italiano',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
|
7
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[domenica lunedì martedì mercoledì giovedì venerdì
|
11
|
+
sabato],
|
12
|
+
wday_abbrs: %w[dom lun mar mer gio ven sab],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
luglio agosto settembre ottobre novembre dicembre
|
11
|
-
month_abbrs: %w
|
14
|
+
month_names: %w[gennaio febbraio marzo aprile maggio giugno
|
15
|
+
luglio agosto settembre ottobre novembre dicembre],
|
16
|
+
month_abbrs: %w[gen feb mar apr mag giu lug ago set ott nov dic],
|
12
17
|
|
13
18
|
date_format: '%d/%m/%Y',
|
14
19
|
|
15
20
|
number_decimal: ',',
|
16
21
|
number_group: ' '
|
22
|
+
)
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
def format_date_full(date, year = true, *_params)
|
25
|
+
full = super(date, year)
|
26
|
+
if full[0..1] == ' 1'
|
27
|
+
'1º' + full[2..-1]
|
28
|
+
else
|
29
|
+
full
|
30
|
+
end
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
data/locales/ja.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Japanese locale
|
6
|
+
class Ja < Locale
|
7
|
+
set(
|
8
|
+
title: '日本語',
|
4
9
|
|
5
10
|
week_start: :sunday,
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日],
|
12
|
+
wday_abbrs: %w[日 月 火 水 木 金 土],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
十二月
|
14
|
+
month_names: %w[一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月
|
15
|
+
十二月],
|
11
16
|
|
12
17
|
date_format: '%Y年%m月%d日',
|
13
18
|
full_format: '%m月%d日',
|
@@ -15,9 +20,11 @@ module R18n
|
|
15
20
|
|
16
21
|
number_decimal: '.',
|
17
22
|
number_group: ','
|
23
|
+
)
|
18
24
|
|
19
|
-
|
20
|
-
|
25
|
+
def pluralize(_n)
|
26
|
+
'n'
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
data/locales/kk.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Kazakh locale
|
6
|
+
class Kk < Locale
|
7
|
+
set(
|
8
|
+
title: 'Қазақша',
|
9
|
+
sublocales: %w[ru en],
|
5
10
|
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[Жексенбі Дүйсенбі Сейсенбі Сәрсенбі Бейсенбі Жұма Сенбі],
|
12
|
+
wday_abbrs: %w[Жк Дс Сс Ср Бс Жм Сн],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
қырқүйек қазан қараша желтоқсан
|
11
|
-
month_abbrs: %w
|
12
|
-
month_standalone: %w
|
13
|
-
Тамыз Қыркүйек Қазан Қараша Желтоқсан
|
14
|
+
month_names: %w[қаңтар ақпан наурыз сәуір мамыр маусым шілде тамыз
|
15
|
+
қырқүйек қазан қараша желтоқсан],
|
16
|
+
month_abbrs: %w[қаң ақп нау сәу мам мау шіл там қыр қаз қар жел],
|
17
|
+
month_standalone: %w[Қаңтар Ақпан Наурыз Сәуір Мамыр Маусым Шілде
|
18
|
+
Тамыз Қыркүйек Қазан Қараша Желтоқсан],
|
14
19
|
|
15
20
|
time_am: ' ертеңің',
|
16
21
|
time_pm: ' кештің',
|
@@ -20,5 +25,7 @@ module R18n
|
|
20
25
|
|
21
26
|
number_decimal: ',',
|
22
27
|
number_group: ' '
|
28
|
+
)
|
29
|
+
end
|
23
30
|
end
|
24
31
|
end
|
data/locales/ko.rb
CHANGED
@@ -1,19 +1,25 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module R18n
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Korean locale
|
6
|
+
class Ko < Locale
|
7
|
+
set(
|
8
|
+
title: '한국어',
|
5
9
|
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[일요일 월요일 화요일 수요일 목요일 금요일 토요일],
|
11
|
+
wday_abbrs: %w[일 월 화 수 목 금 토],
|
8
12
|
|
9
|
-
month_names: %w
|
10
|
-
month_abbrs: %w
|
13
|
+
month_names: %w[1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월],
|
14
|
+
month_abbrs: %w[1 2 3 4 5 6 7 8 9 10 11 12],
|
11
15
|
|
12
16
|
date_format: '%Y/%m/%d',
|
13
17
|
full_format: '%m월 %d일',
|
14
18
|
year_format: '%Y년 _',
|
15
19
|
|
16
|
-
number_decimal:
|
17
|
-
number_group:
|
20
|
+
number_decimal: '.',
|
21
|
+
number_group: ','
|
22
|
+
)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
data/locales/lv.rb
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Latvian locale
|
6
|
+
class Lv < Locale
|
7
|
+
set(
|
8
|
+
title: 'Latviešu',
|
4
9
|
|
5
10
|
week_start: :monday,
|
6
|
-
wday_names: %w
|
7
|
-
Piektdiena Sestdiena
|
8
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[Svētdiena Pirmdiena Otrdiena Trešdiena Ceturtdiena
|
12
|
+
Piektdiena Sestdiena],
|
13
|
+
wday_abbrs: %w[Sv P O T C P S],
|
9
14
|
|
10
|
-
month_names: %w
|
11
|
-
augustā septembrī oktobrī novembrī decembrī
|
12
|
-
month_abbrs: %w
|
13
|
-
month_standalone: %w
|
15
|
+
month_names: %w[janvārī februārī martā aprīlī maijā jūnijā jūlijā
|
16
|
+
augustā septembrī oktobrī novembrī decembrī],
|
17
|
+
month_abbrs: %w[jan feb mar apr mai jūn jūl aug sep okt nov dec],
|
18
|
+
month_standalone: %w[janvāris februāris marts aprīlis maijs jūnijs
|
14
19
|
jūlijs augusts septembris oktobris novembris
|
15
|
-
decembris
|
20
|
+
decembris],
|
16
21
|
|
17
22
|
date_format: '%d.%m.%Y.',
|
18
23
|
full_format: '%e.%B',
|
@@ -20,14 +25,16 @@ module R18n
|
|
20
25
|
|
21
26
|
number_decimal: ',',
|
22
27
|
number_group: ' '
|
28
|
+
)
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
def pluralize(n)
|
31
|
+
if n.zero?
|
32
|
+
0
|
33
|
+
elsif n % 10 == 1 && n % 100 != 11
|
34
|
+
1
|
35
|
+
else
|
36
|
+
'n'
|
37
|
+
end
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|