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/mn.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Mongolian locale
|
6
|
+
class Mn < Locale
|
7
|
+
set(
|
8
|
+
title: 'Монгол',
|
4
9
|
|
5
10
|
wday_names: ['Ням гариг', 'Даваа гариг', 'Мягмар гариг', 'Лхагва гариг',
|
6
11
|
'Пүрэв гариг', 'Баасан гариг', 'Бямба гариг'],
|
7
|
-
wday_abbrs: %w
|
12
|
+
wday_abbrs: %w[ня да мя лх пү ба бя],
|
8
13
|
|
9
14
|
month_names: ['Нэгдүгээр сар', 'Хоёрдугаар сар', 'Гуравдугаар сар',
|
10
15
|
'Дөрөвдүгээр сар', 'Тавдугаар сар', 'Зургадугаар сар',
|
@@ -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/nb.rb
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Norwegian Bokmål locale
|
6
|
+
class Nb < Locale
|
7
|
+
set(
|
8
|
+
title: 'Norsk (bokmål)',
|
9
|
+
sublocales: %w[no nn en],
|
5
10
|
|
6
11
|
week_start: :monday,
|
7
|
-
wday_names: %w
|
8
|
-
wday_abbrs: %w
|
12
|
+
wday_names: %w[søndag mandag tirsdag onsdag torsdag fredag lørdag],
|
13
|
+
wday_abbrs: %w[søn man tir ons tor fre lør],
|
9
14
|
|
10
|
-
month_names: %w
|
11
|
-
september oktober november desember
|
12
|
-
month_abbrs: %w
|
15
|
+
month_names: %w[januar februar mars april mai juni juli august
|
16
|
+
september oktober november desember],
|
17
|
+
month_abbrs: %w[jan feb mar apr mai jun jul aug sep okt nov des],
|
13
18
|
|
14
19
|
date_format: '%d.%m.%Y',
|
15
20
|
full_format: '%e. %B %Y',
|
16
21
|
|
17
22
|
number_decimal: ',',
|
18
23
|
number_group: ' '
|
24
|
+
)
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
data/locales/nl.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Dutch locale
|
6
|
+
class Nl < Locale
|
7
|
+
set(
|
8
|
+
title: 'Nederlands',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
zaterdag
|
7
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[zondag maandag dinsdag woensdag donderdag vrijdag
|
11
|
+
zaterdag],
|
12
|
+
wday_abbrs: %w[zo ma di wo do vr za],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
september oktober november december
|
11
|
-
month_abbrs: %w
|
14
|
+
month_names: %w[januari februari maart april mei juni juli augustus
|
15
|
+
september oktober november december],
|
16
|
+
month_abbrs: %w[jan feb mrt apr mei jun jul aug sep okt nov dec],
|
12
17
|
|
13
18
|
time_am: "'s ochtends",
|
14
19
|
time_pm: "'s middags",
|
@@ -17,5 +22,7 @@ module R18n
|
|
17
22
|
|
18
23
|
number_decimal: ',',
|
19
24
|
number_group: '.'
|
25
|
+
)
|
26
|
+
end
|
20
27
|
end
|
21
28
|
end
|
data/locales/no.rb
CHANGED
@@ -1,20 +1,15 @@
|
|
1
|
-
|
2
|
-
class Locales::No < Locale
|
3
|
-
set title: 'Norsk',
|
4
|
-
sublocales: %w{nb nn en},
|
5
|
-
|
6
|
-
week_start: :monday,
|
7
|
-
wday_names: %w{søndag mandag tirsdag onsdag torsdag fredag lørdag},
|
8
|
-
wday_abbrs: %w{søn man tir ons tor fre lør},
|
1
|
+
# frozen_string_literal: true
|
9
2
|
|
10
|
-
|
11
|
-
september oktober november desember},
|
12
|
-
month_abbrs: %w{jan feb mar apr mai jun jul aug sep okt nov des},
|
3
|
+
require_relative 'nb'
|
13
4
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
module R18n
|
6
|
+
module Locales
|
7
|
+
# @deprecated Norwegian locale
|
8
|
+
class No < Nb
|
9
|
+
class << self
|
10
|
+
extend Gem::Deprecate
|
11
|
+
deprecate :new, 'R18n::Locales::Nb.new', 2018, 3
|
12
|
+
end
|
13
|
+
end
|
19
14
|
end
|
20
15
|
end
|
data/locales/pl.rb
CHANGED
@@ -1,32 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Polish locale
|
6
|
+
class Pl < Locale
|
7
|
+
set(
|
8
|
+
title: 'Polski',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
sobota
|
7
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[niedziela poniedziałek wtorek środa czwartek piątek
|
11
|
+
sobota],
|
12
|
+
wday_abbrs: %w[nd pn wt śr czw pt sob],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
sierpnia września października listopada grudnia
|
11
|
-
month_abbrs: %w
|
12
|
-
month_standalone: %w
|
14
|
+
month_names: %w[stycznia lutego marca kwietnia maja czerwca lipca
|
15
|
+
sierpnia września października listopada grudnia],
|
16
|
+
month_abbrs: %w[I II III IV V VI VII VIII IX X XI XII],
|
17
|
+
month_standalone: %w[styczeń luty marzec kwiecień maj czerwiec lipiec
|
13
18
|
sierpień wrzesień październik listopad
|
14
|
-
grudzień
|
19
|
+
grudzień],
|
15
20
|
|
16
21
|
date_format: '%d.%m.%Y',
|
17
22
|
|
18
23
|
number_decimal: ',',
|
19
24
|
number_group: ' '
|
25
|
+
)
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
def pluralize(n)
|
28
|
+
return 0 if n.zero?
|
29
|
+
case n % 10
|
30
|
+
when 1
|
31
|
+
n > 10 ? 'n' : 1
|
32
|
+
when 2..4
|
33
|
+
(11..19).cover?(n % 100) ? 'n' : 2
|
34
|
+
else
|
35
|
+
'n'
|
36
|
+
end
|
30
37
|
end
|
31
38
|
end
|
32
39
|
end
|
data/locales/pt-br.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require_relative 'pt'
|
4
|
+
|
5
|
+
module R18n
|
6
|
+
module Locales
|
7
|
+
# Brazilian Portuguese locale
|
8
|
+
class PtBr < Pt
|
9
|
+
set(
|
10
|
+
title: 'Português brasileiro',
|
11
|
+
sublocales: %w[pt en]
|
12
|
+
)
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
data/locales/pt.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Portuguese locale
|
6
|
+
class Pt < Locale
|
7
|
+
set(
|
8
|
+
title: 'Português',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
|
7
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[domingo segunda-feira terça-feira quarta-feira
|
11
|
+
quinta-feira sexta-feira sábado],
|
12
|
+
wday_abbrs: %w[dom seg ter qua qui sex sab],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
agosto setembro outubro novembro dezembro
|
11
|
-
month_abbrs: %w
|
12
|
-
month_standalone: %w
|
13
|
-
Agosto Setembro Outubro Novembro Dezembro
|
14
|
+
month_names: %w[janeiro fevereiro março abril maio junho julho
|
15
|
+
agosto setembro outubro novembro dezembro],
|
16
|
+
month_abbrs: %w[jan fev mar abr mai jun jul ago set out nov dez],
|
17
|
+
month_standalone: %w[Janeiro Fevereiro Março Abril Maio Junho Julho
|
18
|
+
Agosto Setembro Outubro Novembro Dezembro],
|
14
19
|
|
15
20
|
date_format: '%d/%m/%Y',
|
16
21
|
full_format: '%d de %B',
|
@@ -18,5 +23,7 @@ module R18n
|
|
18
23
|
|
19
24
|
number_decimal: ',',
|
20
25
|
number_group: '.'
|
26
|
+
)
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
data/locales/ru.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
+
module Locales
|
5
|
+
# Russian locale
|
6
|
+
class Ru < Locale
|
7
|
+
set(
|
8
|
+
title: 'Русский',
|
4
9
|
|
5
|
-
wday_names: %w
|
6
|
-
Суббота
|
7
|
-
wday_abbrs: %w
|
10
|
+
wday_names: %w[Воскресенье Понедельник Вторник Среда Четверг Пятница
|
11
|
+
Суббота],
|
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: ' вечера',
|
@@ -18,16 +23,18 @@ module R18n
|
|
18
23
|
|
19
24
|
number_decimal: ',',
|
20
25
|
number_group: ' '
|
26
|
+
)
|
21
27
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def pluralize(n)
|
29
|
+
if n.zero?
|
30
|
+
0
|
31
|
+
elsif n % 10 == 1 && n % 100 != 11
|
32
|
+
1
|
33
|
+
elsif (2..4).cover?(n % 10) && !(10..19).cover?(n % 100)
|
34
|
+
2
|
35
|
+
else
|
36
|
+
'n'
|
37
|
+
end
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
data/locales/sk.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Slovak locale
|
6
|
+
class Sk < Locale
|
7
|
+
set(
|
8
|
+
title: 'Slovenský',
|
9
|
+
sublocales: %w[cs cz en],
|
5
10
|
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[Nedeľa Pondelok Utorok Streda Štvrtok Piatok Sobota],
|
12
|
+
wday_abbrs: %w[Ne Po Ut St Št Pi So],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
augusta septembra októbra novembra decembra
|
11
|
-
month_abbrs: %w
|
12
|
-
month_standalone: %w
|
13
|
-
September Október November December
|
14
|
+
month_names: %w[januára februára marca apríla mája júna júla
|
15
|
+
augusta septembra októbra novembra decembra],
|
16
|
+
month_abbrs: %w[jan feb mar apr máj jún júl aug sep okt nov dec],
|
17
|
+
month_standalone: %w[Január Február Marec Apríl Máj Jún Júl August
|
18
|
+
September Október November December],
|
14
19
|
|
15
20
|
time_am: 'dop.',
|
16
21
|
time_pm: 'odp.',
|
@@ -19,17 +24,19 @@ module R18n
|
|
19
24
|
|
20
25
|
number_decimal: ',',
|
21
26
|
number_group: ' '
|
27
|
+
)
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def pluralize(n)
|
30
|
+
case n
|
31
|
+
when 0
|
32
|
+
0
|
33
|
+
when 1
|
34
|
+
1
|
35
|
+
when 2..4
|
36
|
+
2
|
37
|
+
else
|
38
|
+
'n'
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
data/locales/sr-latn.rb
CHANGED
@@ -1,31 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Serbian Latin locale
|
6
|
+
class SrLatn < Locale
|
7
|
+
set title: 'Srpski',
|
8
|
+
sublocales: [],
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
|
10
|
+
week_start: :monday,
|
11
|
+
wday_names: %w[nedelja ponedeljak utorak sreda četvrtak petak subota],
|
12
|
+
wday_abbrs: %w[ned pon uto sri čet pet sub],
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
month_names: %w[januar februar mart april maj juni juli avgust
|
15
|
+
septembar oktobar novembar decembar],
|
16
|
+
month_abbrs: %w[jan feb mar apr maj jun jul avg sep okt nov dec],
|
13
17
|
|
14
|
-
|
15
|
-
|
18
|
+
date_format: '%d.%m.%Y',
|
19
|
+
full_format: '%e. %B',
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
number_decimal: ',',
|
22
|
+
number_group: '.'
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
def pluralize(n)
|
25
|
+
if n.zero?
|
26
|
+
0
|
27
|
+
elsif n == 1
|
28
|
+
1
|
29
|
+
elsif n >= 2 && n <= 4
|
30
|
+
2
|
31
|
+
else
|
32
|
+
'n'
|
33
|
+
end
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
data/locales/sv-se.rb
CHANGED
@@ -1,19 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module R18n
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
module Locales
|
5
|
+
# Swedish (Sweden) locale
|
6
|
+
class SvSe < Locale
|
7
|
+
set(
|
8
|
+
title: 'Svenska',
|
9
|
+
sublocales: %w[sv en],
|
5
10
|
|
6
|
-
wday_names: %w
|
7
|
-
wday_abbrs: %w
|
11
|
+
wday_names: %w[söndag måndag tisdag onsdag torsdag fredag lördag],
|
12
|
+
wday_abbrs: %w[sön mån tis ons tor fre lör],
|
8
13
|
|
9
|
-
month_names: %w
|
10
|
-
september oktober november december
|
11
|
-
month_abbrs: %w
|
14
|
+
month_names: %w[januari februari mars april maj juni juli augusti
|
15
|
+
september oktober november december],
|
16
|
+
month_abbrs: %w[jan feb mar apr maj jun jul aug okt nov dec],
|
12
17
|
|
13
18
|
date_format: '%Y-%m-%d',
|
14
19
|
full_format: '%e %B %Y',
|
15
20
|
|
16
21
|
number_decimal: ',',
|
17
22
|
number_group: '.'
|
23
|
+
)
|
24
|
+
end
|
18
25
|
end
|
19
26
|
end
|