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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -33
  3. data/lib/r18n-core.rb +29 -15
  4. data/lib/r18n-core/filter_list.rb +15 -10
  5. data/lib/r18n-core/filters.rb +22 -26
  6. data/lib/r18n-core/helpers.rb +2 -2
  7. data/lib/r18n-core/i18n.rb +61 -59
  8. data/lib/r18n-core/locale.rb +120 -97
  9. data/{locales → lib/r18n-core/locales}/af.rb +12 -8
  10. data/lib/r18n-core/locales/az.rb +38 -0
  11. data/lib/r18n-core/locales/bg.rb +29 -0
  12. data/{locales → lib/r18n-core/locales}/ca.rb +9 -6
  13. data/{locales → lib/r18n-core/locales}/cs.rb +11 -7
  14. data/lib/r18n-core/locales/cy.rb +50 -0
  15. data/{locales → lib/r18n-core/locales}/da.rb +10 -7
  16. data/lib/r18n-core/locales/de.rb +33 -0
  17. data/{locales → lib/r18n-core/locales}/en-au.rb +1 -1
  18. data/{locales → lib/r18n-core/locales}/en-gb.rb +1 -1
  19. data/{locales → lib/r18n-core/locales}/en-us.rb +2 -1
  20. data/{locales → lib/r18n-core/locales}/en.rb +8 -5
  21. data/{locales → lib/r18n-core/locales}/eo.rb +5 -3
  22. data/lib/r18n-core/locales/es-cl.rb +16 -0
  23. data/{locales → lib/r18n-core/locales}/es-us.rb +4 -3
  24. data/{locales → lib/r18n-core/locales}/es.rb +5 -3
  25. data/{locales → lib/r18n-core/locales}/fa.rb +1 -1
  26. data/lib/r18n-core/locales/fi.rb +39 -0
  27. data/{locales → lib/r18n-core/locales}/fr.rb +10 -6
  28. data/{locales → lib/r18n-core/locales}/gl.rb +5 -3
  29. data/{locales → lib/r18n-core/locales}/hr.rb +8 -5
  30. data/{locales → lib/r18n-core/locales}/hu.rb +8 -5
  31. data/{locales → lib/r18n-core/locales}/id.rb +8 -4
  32. data/{locales → lib/r18n-core/locales}/it.rb +8 -5
  33. data/{locales → lib/r18n-core/locales}/ja.rb +4 -3
  34. data/{locales → lib/r18n-core/locales}/kk.rb +11 -7
  35. data/{locales → lib/r18n-core/locales}/ko.rb +0 -0
  36. data/lib/r18n-core/locales/lv.rb +46 -0
  37. data/lib/r18n-core/locales/mn.rb +30 -0
  38. data/{locales → lib/r18n-core/locales}/nb.rb +5 -3
  39. data/{locales → lib/r18n-core/locales}/nl.rb +10 -7
  40. data/{locales → lib/r18n-core/locales}/no.rb +0 -0
  41. data/lib/r18n-core/locales/pl.rb +45 -0
  42. data/{locales → lib/r18n-core/locales}/pt-br.rb +1 -1
  43. data/lib/r18n-core/locales/pt.rb +35 -0
  44. data/lib/r18n-core/locales/ru.rb +46 -0
  45. data/{locales → lib/r18n-core/locales}/sk.rb +10 -6
  46. data/{locales → lib/r18n-core/locales}/sr-latn.rb +5 -3
  47. data/{locales → lib/r18n-core/locales}/sv-se.rb +6 -4
  48. data/lib/r18n-core/locales/th.rb +41 -0
  49. data/{locales → lib/r18n-core/locales}/tr.rb +5 -4
  50. data/lib/r18n-core/locales/uk.rb +31 -0
  51. data/{locales → lib/r18n-core/locales}/vi.rb +11 -7
  52. data/{locales → lib/r18n-core/locales}/zh-cn.rb +1 -1
  53. data/{locales → lib/r18n-core/locales}/zh-tw.rb +3 -3
  54. data/{locales → lib/r18n-core/locales}/zh.rb +4 -3
  55. data/lib/r18n-core/translated.rb +35 -34
  56. data/lib/r18n-core/translated_string.rb +4 -2
  57. data/lib/r18n-core/translation.rb +16 -17
  58. data/lib/r18n-core/unsupported_locale.rb +6 -5
  59. data/lib/r18n-core/untranslated.rb +10 -4
  60. data/lib/r18n-core/utils.rb +1 -14
  61. data/lib/r18n-core/version.rb +1 -1
  62. data/lib/r18n-core/yaml_loader.rb +13 -13
  63. data/lib/r18n-core/yaml_methods.rb +3 -1
  64. data/r18n-core.gemspec +1 -1
  65. data/spec/filters_spec.rb +3 -0
  66. data/spec/i18n_spec.rb +22 -8
  67. data/spec/locale_spec.rb +4 -5
  68. data/spec/locales/af_spec.rb +9 -0
  69. data/spec/locales/en-us_spec.rb +16 -1
  70. data/spec/locales/es-us_spec.rb +11 -0
  71. data/spec/locales/fi_spec.rb +9 -0
  72. data/spec/locales/hu_spec.rb +2 -0
  73. data/spec/locales/id_spec.rb +23 -0
  74. data/spec/locales/vi_spec.rb +4 -3
  75. data/spec/r18n_spec.rb +21 -7
  76. data/spec/spec_helper.rb +0 -7
  77. data/spec/translated_spec.rb +121 -65
  78. data/spec/translation_spec.rb +5 -2
  79. data/spec/translations/with_regions/en-US.yml +0 -0
  80. data/spec/translations/yaml/en-GB.yml +1 -0
  81. data/spec/translations/yaml/en-us.yml +1 -0
  82. data/spec/yaml_loader_spec.rb +4 -2
  83. metadata +64 -50
  84. data/locales/az.rb +0 -34
  85. data/locales/bg.rb +0 -25
  86. data/locales/cy.rb +0 -50
  87. data/locales/de.rb +0 -29
  88. data/locales/fi.rb +0 -35
  89. data/locales/lv.rb +0 -41
  90. data/locales/mn.rb +0 -27
  91. data/locales/pl.rb +0 -40
  92. data/locales/pt.rb +0 -29
  93. data/locales/ru.rb +0 -41
  94. data/locales/th.rb +0 -37
  95. data/locales/uk.rb +0 -27
@@ -10,16 +10,20 @@ module R18n
10
10
  wday_names: %w[dimanche lundi mardi mercredi jeudi vendredi samedi],
11
11
  wday_abbrs: %w[dim lun mar mer jeu ven sam],
12
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
+ month_names: %w[
14
+ janvier février mars avril mai juin juillet août septembre octobre
15
+ novembre décembre
16
+ ],
17
+ month_abbrs: %w[jan fév mar avr mai jun jui aoû sep oct nov déc],
18
+ month_standalone: %w[
19
+ Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre
20
+ Novembre Décembre
21
+ ],
18
22
 
19
23
  date_format: '%d/%m/%Y',
20
24
 
21
25
  number_decimal: ',',
22
- number_group: ' '
26
+ number_group: ' '
23
27
  )
24
28
 
25
29
  def format_date_full(date, year = true, *_params)
@@ -11,8 +11,10 @@ module R18n
11
11
  wday_names: %w[domingo luns martes mércores xoves venres sábado],
12
12
  wday_abbrs: %w[dom lun mar mér xov ven sáb],
13
13
 
14
- month_names: %w[xaneiro febreiro marzo abril maio xuño xullo
15
- agosto setembro outubro novembro decembro],
14
+ month_names: %w[
15
+ xaneiro febreiro marzo abril maio xuño xullo agosto setembro outubro
16
+ novembro decembro
17
+ ],
16
18
  month_abbrs: %w[xan feb mar abr mai xuñ xul ago set out nov dec],
17
19
 
18
20
  date_format: '%d/%m/%Y',
@@ -20,7 +22,7 @@ module R18n
20
22
  year_format: '_ de %Y',
21
23
 
22
24
  number_decimal: ',',
23
- number_group: '.'
25
+ number_group: '.'
24
26
  )
25
27
  end
26
28
  end
@@ -8,19 +8,22 @@ module R18n
8
8
  title: 'Hrvatski',
9
9
 
10
10
  week_start: :monday,
11
- wday_names: %w[Nedjelja Ponedjeljak Utorak Srijeda Četvrtak Petak
12
- Subota],
11
+ wday_names: %w[
12
+ Nedjelja Ponedjeljak Utorak Srijeda Četvrtak Petak Subota
13
+ ],
13
14
  wday_abbrs: %w[Ned Pon Uto Sri Čet Pet Sub],
14
15
 
15
- month_names: %w[Siječanj Veljača Ožujak Travanj Svibanj Lipanj Srpanj
16
- Kolovoz Rujan Listopad Studeni Prosinac],
16
+ month_names: %w[
17
+ Siječanj Veljača Ožujak Travanj Svibanj Lipanj Srpanj Kolovoz Rujan
18
+ Listopad Studeni Prosinac
19
+ ],
17
20
  month_abbrs: %w[Sij Velj Ožu Tra Svi Lip Srp Kol Ruj Lis Stu Pro],
18
21
 
19
22
  date_format: '%d.%m.%Y',
20
23
  full_format: '%-d. %B',
21
24
 
22
25
  number_decimal: ',',
23
- number_group: '.'
26
+ number_group: '.'
24
27
  )
25
28
 
26
29
  def pluralize(number)
@@ -11,17 +11,20 @@ module R18n
11
11
  wday_names: %w[vasárnap hétfő kedd szerda csütörtök péntek szombat],
12
12
  wday_abbrs: %w[vas hét ked sze csü pén szo],
13
13
 
14
- month_names: %w[január február március április május június július
15
- augusztus szeptember október november december],
14
+ month_names: %w[
15
+ január február március április május június július augusztus
16
+ szeptember október november december
17
+ ],
16
18
  month_abbrs: %w[jan feb már ápr máj jún júl aug sze okt nov dec],
17
19
 
18
20
  date_format: '%Y. %m. %d.',
19
21
  full_format: '%B %-d.',
20
22
  year_format: '%Y. _',
21
- time_format: '_, %H:%M',
23
+ time_format: '_, %R',
24
+ time_with_seconds_format: '_, %T',
22
25
 
23
26
  number_decimal: ',',
24
- number_group: ' '
27
+ number_group: ' '
25
28
  )
26
29
 
27
30
  def pluralize(_number)
@@ -30,7 +33,7 @@ module R18n
30
33
 
31
34
  def format_integer(integer)
32
35
  str = integer.to_s
33
- str[0] = '−' if integer < 0 # Real typographic minus
36
+ str[0] = '−' if integer.negative? # Real typographic minus
34
37
  group = number_group
35
38
 
36
39
  # only group numbers if it has at least 5 digits
@@ -10,14 +10,18 @@ module R18n
10
10
  wday_names: %w[Minggu Senin Selasa Rabu Kamis Jumat Sabtu],
11
11
  wday_abbrs: %w[Min Sen Sel Rab Kam Jum Sab],
12
12
 
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],
13
+ month_names: %w[
14
+ Januari Februari Maret April Mei Juni Juli Agustus September Oktober
15
+ November Desember
16
+ ],
17
+ month_abbrs: %w[Jan Feb Mar Apr Mei Jun Jul Agu Sep Okt Nov Des],
16
18
 
17
19
  date_format: '%d/%m/%Y',
20
+ time_format: '_ pukul %H.%M',
21
+ time_with_seconds_format: '_ pukul %H.%M.%S',
18
22
 
19
23
  number_decimal: ',',
20
- number_group: '.'
24
+ number_group: '.'
21
25
  )
22
26
  end
23
27
  end
@@ -7,18 +7,21 @@ module R18n
7
7
  set(
8
8
  title: 'Italiano',
9
9
 
10
- wday_names: %w[domenica lunedì martedì mercoledì giovedì venerdì
11
- sabato],
10
+ wday_names: %w[
11
+ domenica lunedì martedì mercoledì giovedì venerdì sabato
12
+ ],
12
13
  wday_abbrs: %w[dom lun mar mer gio ven sab],
13
14
 
14
- month_names: %w[gennaio febbraio marzo aprile maggio giugno
15
- luglio agosto settembre ottobre novembre dicembre],
15
+ month_names: %w[
16
+ gennaio febbraio marzo aprile maggio giugno luglio agosto settembre
17
+ ottobre novembre dicembre
18
+ ],
16
19
  month_abbrs: %w[gen feb mar apr mag giu lug ago set ott nov dic],
17
20
 
18
21
  date_format: '%d/%m/%Y',
19
22
 
20
23
  number_decimal: ',',
21
- number_group: ' '
24
+ number_group: ' '
22
25
  )
23
26
 
24
27
  def format_date_full(date, year = true, *_params)
@@ -11,15 +11,16 @@ module R18n
11
11
  wday_names: %w[日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日],
12
12
  wday_abbrs: %w[日 月 火 水 木 金 土],
13
13
 
14
- month_names: %w[一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月
15
- 十二月],
14
+ month_names: %w[
15
+ 一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月
16
+ ],
16
17
 
17
18
  date_format: '%Y年%m月%d日',
18
19
  full_format: '%m月%d日',
19
20
  year_format: '%Y年_',
20
21
 
21
22
  number_decimal: '.',
22
- number_group: ','
23
+ number_group: ','
23
24
  )
24
25
 
25
26
  def pluralize(_number)
@@ -11,20 +11,24 @@ module R18n
11
11
  wday_names: %w[Жексенбі Дүйсенбі Сейсенбі Сәрсенбі Бейсенбі Жұма Сенбі],
12
12
  wday_abbrs: %w[Жк Дс Сс Ср Бс Жм Сн],
13
13
 
14
- month_names: %w[қаңтар ақпан наурыз сәуір мамыр маусым шілде тамыз
15
- қырқүйек қазан қараша желтоқсан],
14
+ month_names: %w[
15
+ қаңтар ақпан наурыз сәуір мамыр маусым шілде тамыз қырқүйек қазан
16
+ қараша желтоқсан
17
+ ],
16
18
  month_abbrs: %w[қаң ақп нау сәу мам мау шіл там қыр қаз қар жел],
17
- month_standalone: %w[Қаңтар Ақпан Наурыз Сәуір Мамыр Маусым Шілде
18
- Тамыз Қыркүйек Қазан Қараша Желтоқсан],
19
+ month_standalone: %w[
20
+ Қаңтар Ақпан Наурыз Сәуір Мамыр Маусым Шілде Тамыз Қыркүйек Қазан
21
+ Қараша Желтоқсан
22
+ ],
19
23
 
20
- time_am: ' ертеңің',
21
- time_pm: ' кештің',
24
+ time_am: ' ертеңің',
25
+ time_pm: ' кештің',
22
26
  date_format: '%Y-%m-%d',
23
27
  full_format: '%B %-d-і',
24
28
  year_format: '%Y жылы _',
25
29
 
26
30
  number_decimal: ',',
27
- number_group: ' '
31
+ number_group: ' '
28
32
  )
29
33
  end
30
34
  end
File without changes
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # Latvian locale
6
+ class Lv < Locale
7
+ set(
8
+ title: 'Latviešu',
9
+
10
+ week_start: :monday,
11
+ wday_names: %w[
12
+ Svētdiena Pirmdiena Otrdiena Trešdiena Ceturtdiena Piektdiena
13
+ Sestdiena
14
+ ],
15
+ wday_abbrs: %w[Sv P O T C P S],
16
+
17
+ month_names: %w[
18
+ janvārī februārī martā aprīlī maijā jūnijā jūlijā augustā septembrī
19
+ oktobrī novembrī decembrī
20
+ ],
21
+ month_abbrs: %w[jan feb mar apr mai jūn jūl aug sep okt nov dec],
22
+ month_standalone: %w[
23
+ janvāris februāris marts aprīlis maijs jūnijs jūlijs augusts
24
+ septembris oktobris novembris decembris
25
+ ],
26
+
27
+ date_format: '%d.%m.%Y.',
28
+ full_format: '%-d.%B',
29
+ year_format: '%Y.gada _',
30
+
31
+ number_decimal: ',',
32
+ number_group: ' '
33
+ )
34
+
35
+ def pluralize(number)
36
+ if number.zero?
37
+ 0
38
+ elsif number % 10 == 1 && number % 100 != 11
39
+ 1
40
+ else
41
+ 'n'
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # Mongolian locale
6
+ class Mn < Locale
7
+ set(
8
+ title: 'Монгол',
9
+
10
+ wday_names: [
11
+ 'Ням гариг', 'Даваа гариг', 'Мягмар гариг', 'Лхагва гариг',
12
+ 'Пүрэв гариг', 'Баасан гариг', 'Бямба гариг'
13
+ ],
14
+ wday_abbrs: %w[ня да мя лх пү ба бя],
15
+
16
+ month_names: [
17
+ 'Нэгдүгээр сар', 'Хоёрдугаар сар', 'Гуравдугаар сар',
18
+ 'Дөрөвдүгээр сар', 'Тавдугаар сар', 'Зургадугаар сар',
19
+ 'Долдугаар сар', 'Наймдугаар сар', 'Есдүгээр сар',
20
+ 'Аравдугаар сар', 'Арваннэгдүгээр сар', 'Арванхоёрдугаар сар'
21
+ ],
22
+
23
+ date_format: '%Y-%m-%d',
24
+
25
+ number_decimal: ',',
26
+ number_group: '.'
27
+ )
28
+ end
29
+ end
30
+ end
@@ -12,15 +12,17 @@ module R18n
12
12
  wday_names: %w[søndag mandag tirsdag onsdag torsdag fredag lørdag],
13
13
  wday_abbrs: %w[søn man tir ons tor fre lør],
14
14
 
15
- month_names: %w[januar februar mars april mai juni juli august
16
- september oktober november desember],
15
+ month_names: %w[
16
+ januar februar mars april mai juni juli august september oktober
17
+ november desember
18
+ ],
17
19
  month_abbrs: %w[jan feb mar apr mai jun jul aug sep okt nov des],
18
20
 
19
21
  date_format: '%d.%m.%Y',
20
22
  full_format: '%-d. %B %Y',
21
23
 
22
24
  number_decimal: ',',
23
- number_group: ' '
25
+ number_group: ' '
24
26
  )
25
27
  end
26
28
  end
@@ -7,21 +7,24 @@ module R18n
7
7
  set(
8
8
  title: 'Nederlands',
9
9
 
10
- wday_names: %w[zondag maandag dinsdag woensdag donderdag vrijdag
11
- zaterdag],
10
+ wday_names: %w[
11
+ zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
12
+ ],
12
13
  wday_abbrs: %w[zo ma di wo do vr za],
13
14
 
14
- month_names: %w[januari februari maart april mei juni juli augustus
15
- september oktober november december],
15
+ month_names: %w[
16
+ januari februari maart april mei juni juli augustus september oktober
17
+ november december
18
+ ],
16
19
  month_abbrs: %w[jan feb mrt apr mei jun jul aug sep okt nov dec],
17
20
 
18
- time_am: "'s ochtends",
19
- time_pm: "'s middags",
21
+ time_am: "'s ochtends",
22
+ time_pm: "'s middags",
20
23
  date_format: '%d-%m-%Y',
21
24
  full_format: '%-d %B',
22
25
 
23
26
  number_decimal: ',',
24
- number_group: '.'
27
+ number_group: '.'
25
28
  )
26
29
  end
27
30
  end
File without changes
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # Polish locale
6
+ class Pl < Locale
7
+ set(
8
+ title: 'Polski',
9
+
10
+ wday_names: %w[
11
+ niedziela poniedziałek wtorek środa czwartek piątek sobota
12
+ ],
13
+ wday_abbrs: %w[nd pn wt śr czw pt sob],
14
+
15
+ month_names: %w[
16
+ stycznia lutego marca kwietnia maja czerwca lipca sierpnia września
17
+ października listopada grudnia
18
+ ],
19
+ month_abbrs: %w[I II III IV V VI VII VIII IX X XI XII],
20
+ month_standalone: %w[
21
+ styczeń luty marzec kwiecień maj czerwiec lipiec sierpień wrzesień
22
+ październik listopad grudzień
23
+ ],
24
+
25
+ date_format: '%d.%m.%Y',
26
+
27
+ number_decimal: ',',
28
+ number_group: ' '
29
+ )
30
+
31
+ def pluralize(number)
32
+ return 0 if number.zero?
33
+
34
+ case number % 10
35
+ when 1
36
+ number > 10 ? 'n' : 1
37
+ when 2..4
38
+ (11..19).cover?(number % 100) ? 'n' : 2
39
+ else
40
+ 'n'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -5,7 +5,7 @@ require_relative 'pt'
5
5
  module R18n
6
6
  module Locales
7
7
  # Brazilian Portuguese locale
8
- class PtBr < Pt
8
+ class PtBR < Pt
9
9
  set(
10
10
  title: 'Português brasileiro',
11
11
  sublocales: %w[pt en]
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # Portuguese locale
6
+ class Pt < Locale
7
+ set(
8
+ title: 'Português',
9
+
10
+ wday_names: %w[
11
+ domingo segunda-feira terça-feira quarta-feira quinta-feira
12
+ sexta-feira sábado
13
+ ],
14
+ wday_abbrs: %w[dom seg ter qua qui sex sab],
15
+
16
+ month_names: %w[
17
+ janeiro fevereiro março abril maio junho julho agosto setembro
18
+ outubro novembro dezembro
19
+ ],
20
+ month_abbrs: %w[jan fev mar abr mai jun jul ago set out nov dez],
21
+ month_standalone: %w[
22
+ Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro
23
+ Outubro Novembro Dezembro
24
+ ],
25
+
26
+ date_format: '%d/%m/%Y',
27
+ full_format: '%d de %B',
28
+ year_format: '_ de %Y',
29
+
30
+ number_decimal: ',',
31
+ number_group: '.'
32
+ )
33
+ end
34
+ end
35
+ end