r18n-core 3.1.1 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +398 -0
  3. data/README.md +63 -47
  4. data/base/cy.yml +34 -0
  5. data/lib/r18n-core.rb +37 -38
  6. data/lib/r18n-core/filter_list.rb +21 -13
  7. data/lib/r18n-core/filters.rb +43 -48
  8. data/lib/r18n-core/helpers.rb +2 -2
  9. data/lib/r18n-core/i18n.rb +70 -78
  10. data/lib/r18n-core/locale.rb +137 -107
  11. data/lib/r18n-core/locales/af.rb +36 -0
  12. data/lib/r18n-core/locales/az.rb +38 -0
  13. data/lib/r18n-core/locales/bg.rb +29 -0
  14. data/{locales → lib/r18n-core/locales}/ca.rb +9 -6
  15. data/{locales → lib/r18n-core/locales}/cs.rb +15 -11
  16. data/lib/r18n-core/locales/cy.rb +50 -0
  17. data/{locales → lib/r18n-core/locales}/da.rb +10 -7
  18. data/lib/r18n-core/locales/de.rb +33 -0
  19. data/{locales → lib/r18n-core/locales}/en-au.rb +2 -2
  20. data/{locales → lib/r18n-core/locales}/en-gb.rb +2 -2
  21. data/{locales → lib/r18n-core/locales}/en-us.rb +4 -3
  22. data/lib/r18n-core/locales/en.rb +51 -0
  23. data/{locales → lib/r18n-core/locales}/eo.rb +6 -4
  24. data/lib/r18n-core/locales/es-cl.rb +16 -0
  25. data/{locales → lib/r18n-core/locales}/es-us.rb +5 -4
  26. data/{locales → lib/r18n-core/locales}/es.rb +7 -3
  27. data/{locales → lib/r18n-core/locales}/fa.rb +2 -2
  28. data/lib/r18n-core/locales/fi.rb +39 -0
  29. data/lib/r18n-core/locales/fr.rb +39 -0
  30. data/{locales → lib/r18n-core/locales}/gl.rb +5 -3
  31. data/{locales → lib/r18n-core/locales}/hr.rb +13 -10
  32. data/{locales → lib/r18n-core/locales}/hu.rb +10 -7
  33. data/{locales → lib/r18n-core/locales}/id.rb +8 -4
  34. data/lib/r18n-core/locales/it.rb +37 -0
  35. data/{locales → lib/r18n-core/locales}/ja.rb +5 -4
  36. data/{locales → lib/r18n-core/locales}/kk.rb +12 -8
  37. data/{locales → lib/r18n-core/locales}/ko.rb +0 -0
  38. data/lib/r18n-core/locales/lv.rb +46 -0
  39. data/lib/r18n-core/locales/mn.rb +30 -0
  40. data/{locales → lib/r18n-core/locales}/nb.rb +6 -4
  41. data/lib/r18n-core/locales/nl.rb +31 -0
  42. data/{locales → lib/r18n-core/locales}/no.rb +0 -0
  43. data/lib/r18n-core/locales/pl.rb +45 -0
  44. data/{locales → lib/r18n-core/locales}/pt-br.rb +1 -1
  45. data/lib/r18n-core/locales/pt.rb +37 -0
  46. data/lib/r18n-core/locales/ru.rb +46 -0
  47. data/{locales → lib/r18n-core/locales}/sk.rb +13 -9
  48. data/{locales → lib/r18n-core/locales}/sr-latn.rb +10 -8
  49. data/{locales → lib/r18n-core/locales}/sv-se.rb +7 -5
  50. data/lib/r18n-core/locales/th.rb +41 -0
  51. data/{locales → lib/r18n-core/locales}/tr.rb +7 -6
  52. data/lib/r18n-core/locales/uk.rb +31 -0
  53. data/lib/r18n-core/locales/vi.rb +37 -0
  54. data/{locales → lib/r18n-core/locales}/zh-cn.rb +2 -2
  55. data/{locales → lib/r18n-core/locales}/zh-tw.rb +4 -4
  56. data/{locales → lib/r18n-core/locales}/zh.rb +7 -4
  57. data/lib/r18n-core/translated.rb +38 -37
  58. data/lib/r18n-core/translated_string.rb +19 -8
  59. data/lib/r18n-core/translation.rb +24 -19
  60. data/lib/r18n-core/unsupported_locale.rb +14 -6
  61. data/lib/r18n-core/untranslated.rb +23 -7
  62. data/lib/r18n-core/utils.rb +19 -23
  63. data/lib/r18n-core/version.rb +1 -1
  64. data/lib/r18n-core/yaml_loader.rb +17 -13
  65. data/lib/r18n-core/yaml_methods.rb +3 -1
  66. metadata +245 -118
  67. data/.rspec +0 -1
  68. data/Rakefile +0 -13
  69. data/locales/af.rb +0 -32
  70. data/locales/az.rb +0 -34
  71. data/locales/bg.rb +0 -25
  72. data/locales/de.rb +0 -29
  73. data/locales/en.rb +0 -48
  74. data/locales/fi.rb +0 -35
  75. data/locales/fr.rb +0 -35
  76. data/locales/it.rb +0 -34
  77. data/locales/lv.rb +0 -41
  78. data/locales/mn.rb +0 -27
  79. data/locales/nl.rb +0 -28
  80. data/locales/pl.rb +0 -40
  81. data/locales/pt.rb +0 -29
  82. data/locales/ru.rb +0 -41
  83. data/locales/th.rb +0 -37
  84. data/locales/uk.rb +0 -27
  85. data/locales/vi.rb +0 -33
  86. data/r18n-core.gemspec +0 -29
  87. data/spec/filters_spec.rb +0 -324
  88. data/spec/i18n_spec.rb +0 -260
  89. data/spec/locale_spec.rb +0 -216
  90. data/spec/locales/cs_spec.rb +0 -23
  91. data/spec/locales/en-us_spec.rb +0 -13
  92. data/spec/locales/en_spec.rb +0 -13
  93. data/spec/locales/fa_spec.rb +0 -10
  94. data/spec/locales/fr_spec.rb +0 -9
  95. data/spec/locales/hu_spec.rb +0 -17
  96. data/spec/locales/it_spec.rb +0 -10
  97. data/spec/locales/no_spec.rb +0 -9
  98. data/spec/locales/pl_spec.rb +0 -23
  99. data/spec/locales/ru_spec.rb +0 -23
  100. data/spec/locales/sk_spec.rb +0 -23
  101. data/spec/locales/th_spec.rb +0 -9
  102. data/spec/locales/vi_spec.rb +0 -8
  103. data/spec/r18n_spec.rb +0 -172
  104. data/spec/spec_helper.rb +0 -41
  105. data/spec/translated_spec.rb +0 -163
  106. data/spec/translation_spec.rb +0 -164
  107. data/spec/translations/extension/deep/en.yml +0 -1
  108. data/spec/translations/extension/en.yml +0 -2
  109. data/spec/translations/extension/notransl.yml +0 -1
  110. data/spec/translations/general/en.yml +0 -47
  111. data/spec/translations/general/nolocale.yml +0 -6
  112. data/spec/translations/general/ru.yml +0 -7
  113. data/spec/translations/two/en.yml +0 -2
  114. data/spec/translations/two/fr.yml +0 -0
  115. data/spec/yaml_loader_spec.rb +0 -61
@@ -7,11 +7,15 @@ module R18n
7
7
  set(
8
8
  title: 'Español',
9
9
 
10
+ sublocales: %w[es-US es-CL],
11
+
10
12
  wday_names: %w[domingo lunes martes miércoles jueves viernes sábado],
11
13
  wday_abbrs: %w[dom lun mar mie jue vie sab],
12
14
 
13
- month_names: %w[Enero Febrero Marzo Abril Mayo Junio Julio Agosto
14
- Septiembre Octubre Noviembre Diciembre],
15
+ month_names: %w[
16
+ Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre
17
+ Noviembre Diciembre
18
+ ],
15
19
  month_abbrs: %w[ene feb mar abr may jun jul ago sep oct nov dic],
16
20
 
17
21
  date_format: '%d/%m/%Y',
@@ -19,7 +23,7 @@ module R18n
19
23
  year_format: '_ de %Y',
20
24
 
21
25
  number_decimal: ',',
22
- number_group: '.'
26
+ number_group: '.'
23
27
  )
24
28
  end
25
29
  end
@@ -20,11 +20,11 @@ module R18n
20
20
  ],
21
21
 
22
22
  date_format: '%Y/%m/%d',
23
- full_format: '%e %B',
23
+ full_format: '%-d %B',
24
24
  year_format: '_ %Y',
25
25
 
26
26
  number_decimal: '٫',
27
- number_group: '٬'
27
+ number_group: '٬'
28
28
  )
29
29
 
30
30
  # Change direction
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # Finnish locale
6
+ class Fi < Locale
7
+ set(
8
+ title: 'Suomi',
9
+
10
+ wday_names: %w[
11
+ sunnuntai maanantai tiistai keskiviikko torstai terjantai lauantai
12
+ ],
13
+ wday_abbrs: %w[su ma ti ke to te la],
14
+
15
+ month_names: %w[
16
+ tammikuuta helmikuuta maaliskuuta huhtikuuta toukokuuta kesäkuuta
17
+ heinäkuuta elokuuta syyskuuta lokakuuta marraskuuta joulukuuta
18
+ ],
19
+ month_abbrs: %w[tam hel maa huh tou kes hei elo syy lok mar jou],
20
+ month_standalone: %w[
21
+ tammikuu helmikuu maaliskuu huhtikuu toukokuu kesäkuu heinäkuu elokuu
22
+ syyskuu lokakuu marraskuu joulukuu
23
+ ],
24
+
25
+ date_format: '%d.%m.%Y',
26
+ full_format: '%-d. %B',
27
+ time_format: '_ %H.%M',
28
+ time_with_seconds_format: '_ %H.%M.%S',
29
+
30
+ number_decimal: ',',
31
+ number_group: ''
32
+ )
33
+
34
+ def format_time_full(time)
35
+ format_time "#{format_date_full(time)} kello", time
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # French locale
6
+ class Fr < Locale
7
+ set(
8
+ title: 'Français',
9
+
10
+ wday_names: %w[dimanche lundi mardi mercredi jeudi vendredi samedi],
11
+ wday_abbrs: %w[dim lun mar mer jeu ven sam],
12
+
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
+ ],
22
+
23
+ date_format: '%d/%m/%Y',
24
+
25
+ number_decimal: ',',
26
+ number_group: ' '
27
+ )
28
+
29
+ def format_date_full(date, year: true, **_kwargs)
30
+ full = super(date, year: year)
31
+ if full[0..1] == '1 '
32
+ "1er#{full[1..-1]}"
33
+ else
34
+ full
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -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,27 +8,30 @@ 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
- full_format: '%e. %B',
23
+ full_format: '%-d. %B',
21
24
 
22
25
  number_decimal: ',',
23
- number_group: '.'
26
+ number_group: '.'
24
27
  )
25
28
 
26
- def pluralize(n)
27
- if n.zero?
29
+ def pluralize(number)
30
+ if number.zero?
28
31
  0
29
- elsif n == 1
32
+ elsif number == 1
30
33
  1
31
- elsif n >= 2 && n <= 4
34
+ elsif number >= 2 && number <= 4
32
35
  2
33
36
  else
34
37
  'n'
@@ -11,26 +11,29 @@ 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
- full_format: '%B %e.',
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
- def pluralize(_n)
30
+ def pluralize(_number)
28
31
  'n'
29
32
  end
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
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module R18n
4
+ module Locales
5
+ # Italian locale
6
+ class It < Locale
7
+ set(
8
+ title: 'Italiano',
9
+
10
+ wday_names: %w[
11
+ domenica lunedì martedì mercoledì giovedì venerdì sabato
12
+ ],
13
+ wday_abbrs: %w[dom lun mar mer gio ven sab],
14
+
15
+ month_names: %w[
16
+ gennaio febbraio marzo aprile maggio giugno luglio agosto settembre
17
+ ottobre novembre dicembre
18
+ ],
19
+ month_abbrs: %w[gen feb mar apr mag giu lug ago set ott nov dic],
20
+
21
+ date_format: '%d/%m/%Y',
22
+
23
+ number_decimal: ',',
24
+ number_group: ' '
25
+ )
26
+
27
+ def format_date_full(date, year: true, **_kwargs)
28
+ full = super(date, year: year)
29
+ if full[0..1] == '1 '
30
+ "1º#{full[1..-1]}"
31
+ else
32
+ full
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -11,18 +11,19 @@ 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
- def pluralize(_n)
26
+ def pluralize(_number)
26
27
  'n'
27
28
  end
28
29
  end
@@ -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
- full_format: '%B %e-і',
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
- full_format: '%e. %B %Y',
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