sayso-i18n 0.5.0.001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/CHANGELOG.textile +152 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.textile +103 -0
  4. data/ci/Gemfile.no-rails +5 -0
  5. data/ci/Gemfile.no-rails.lock +14 -0
  6. data/ci/Gemfile.rails-2.3.x +9 -0
  7. data/ci/Gemfile.rails-2.3.x.lock +23 -0
  8. data/ci/Gemfile.rails-3.x +9 -0
  9. data/ci/Gemfile.rails-3.x.lock +23 -0
  10. data/lib/i18n.rb +324 -0
  11. data/lib/i18n/backend.rb +19 -0
  12. data/lib/i18n/backend/base.rb +174 -0
  13. data/lib/i18n/backend/cache.rb +102 -0
  14. data/lib/i18n/backend/cascade.rb +53 -0
  15. data/lib/i18n/backend/chain.rb +80 -0
  16. data/lib/i18n/backend/fallbacks.rb +70 -0
  17. data/lib/i18n/backend/flatten.rb +113 -0
  18. data/lib/i18n/backend/flatten_yml.rb +70 -0
  19. data/lib/i18n/backend/gettext.rb +71 -0
  20. data/lib/i18n/backend/interpolation_compiler.rb +121 -0
  21. data/lib/i18n/backend/key_value.rb +100 -0
  22. data/lib/i18n/backend/memoize.rb +46 -0
  23. data/lib/i18n/backend/metadata.rb +65 -0
  24. data/lib/i18n/backend/pluralization.rb +55 -0
  25. data/lib/i18n/backend/simple.rb +87 -0
  26. data/lib/i18n/backend/transliterator.rb +98 -0
  27. data/lib/i18n/config.rb +86 -0
  28. data/lib/i18n/core_ext/hash.rb +29 -0
  29. data/lib/i18n/core_ext/kernel/surpress_warnings.rb +9 -0
  30. data/lib/i18n/core_ext/string/interpolate.rb +105 -0
  31. data/lib/i18n/exceptions.rb +88 -0
  32. data/lib/i18n/gettext.rb +25 -0
  33. data/lib/i18n/gettext/helpers.rb +64 -0
  34. data/lib/i18n/gettext/po_parser.rb +329 -0
  35. data/lib/i18n/interpolate/ruby.rb +31 -0
  36. data/lib/i18n/locale.rb +6 -0
  37. data/lib/i18n/locale/fallbacks.rb +96 -0
  38. data/lib/i18n/locale/tag.rb +28 -0
  39. data/lib/i18n/locale/tag/parents.rb +22 -0
  40. data/lib/i18n/locale/tag/rfc4646.rb +74 -0
  41. data/lib/i18n/locale/tag/simple.rb +39 -0
  42. data/lib/i18n/tests.rb +12 -0
  43. data/lib/i18n/tests/basics.rb +54 -0
  44. data/lib/i18n/tests/defaults.rb +40 -0
  45. data/lib/i18n/tests/interpolation.rb +133 -0
  46. data/lib/i18n/tests/link.rb +56 -0
  47. data/lib/i18n/tests/localization.rb +19 -0
  48. data/lib/i18n/tests/localization/date.rb +84 -0
  49. data/lib/i18n/tests/localization/date_time.rb +77 -0
  50. data/lib/i18n/tests/localization/procs.rb +116 -0
  51. data/lib/i18n/tests/localization/time.rb +76 -0
  52. data/lib/i18n/tests/lookup.rb +74 -0
  53. data/lib/i18n/tests/pluralization.rb +35 -0
  54. data/lib/i18n/tests/procs.rb +55 -0
  55. data/lib/i18n/version.rb +3 -0
  56. data/test/all.rb +8 -0
  57. data/test/api/all_features_test.rb +58 -0
  58. data/test/api/cascade_test.rb +28 -0
  59. data/test/api/chain_test.rb +24 -0
  60. data/test/api/fallbacks_test.rb +30 -0
  61. data/test/api/flatten_yml_test.rb +32 -0
  62. data/test/api/key_value_test.rb +28 -0
  63. data/test/api/memoize_test.rb +60 -0
  64. data/test/api/pluralization_test.rb +30 -0
  65. data/test/api/simple_test.rb +28 -0
  66. data/test/backend/cache_test.rb +83 -0
  67. data/test/backend/cascade_test.rb +85 -0
  68. data/test/backend/chain_test.rb +72 -0
  69. data/test/backend/exceptions_test.rb +23 -0
  70. data/test/backend/fallbacks_test.rb +120 -0
  71. data/test/backend/flatten_yml_test.rb +49 -0
  72. data/test/backend/interpolation_compiler_test.rb +102 -0
  73. data/test/backend/key_value_test.rb +46 -0
  74. data/test/backend/memoize_test.rb +47 -0
  75. data/test/backend/metadata_test.rb +67 -0
  76. data/test/backend/pluralization_test.rb +44 -0
  77. data/test/backend/simple_test.rb +83 -0
  78. data/test/backend/transliterator_test.rb +81 -0
  79. data/test/core_ext/hash_test.rb +30 -0
  80. data/test/core_ext/string/interpolate_test.rb +99 -0
  81. data/test/gettext/api_test.rb +206 -0
  82. data/test/gettext/backend_test.rb +93 -0
  83. data/test/i18n/exceptions_test.rb +116 -0
  84. data/test/i18n/interpolate_test.rb +61 -0
  85. data/test/i18n/load_path_test.rb +26 -0
  86. data/test/i18n_test.rb +236 -0
  87. data/test/locale/fallbacks_test.rb +124 -0
  88. data/test/locale/tag/rfc4646_test.rb +142 -0
  89. data/test/locale/tag/simple_test.rb +32 -0
  90. data/test/run_all.rb +21 -0
  91. data/test/test_data/locales/de.po +72 -0
  92. data/test/test_data/locales/en.rb +3 -0
  93. data/test/test_data/locales/en.yml +3 -0
  94. data/test/test_data/locales/invalid/empty.yml +1 -0
  95. data/test/test_data/locales/plurals.rb +113 -0
  96. data/test/test_helper.rb +56 -0
  97. metadata +194 -0
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+ require 'test_helper'
3
+
4
+ class I18nLocaleTagSimpleTest < Test::Unit::TestCase
5
+ include I18n::Locale
6
+
7
+ test "returns 'de' as the language subtag in lowercase" do
8
+ assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').subtags
9
+ end
10
+
11
+ test "returns a formatted tag string from #to_s" do
12
+ assert_equal 'de-Latn-DE', Tag::Simple.new('de-Latn-DE').to_s
13
+ end
14
+
15
+ test "returns an array containing the formatted subtags from #to_a" do
16
+ assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').to_a
17
+ end
18
+
19
+ # Tag inheritance
20
+
21
+ test "#parent returns 'de-Latn' as the parent of 'de-Latn-DE'" do
22
+ assert_equal 'de-Latn', Tag::Simple.new('de-Latn-DE').parent.to_s
23
+ end
24
+
25
+ test "#parent returns 'de' as the parent of 'de-Latn'" do
26
+ assert_equal 'de', Tag::Simple.new('de-Latn').parent.to_s
27
+ end
28
+
29
+ test "#self_and_parents returns an array of 3 tags for 'de-Latn-DE'" do
30
+ assert_equal %w(de-Latn-DE de-Latn de), Tag::Simple.new('de-Latn-DE').self_and_parents.map { |tag| tag.to_s}
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ def bundle_check
2
+ `bundle check` == "The Gemfile's dependencies are satisfied\n"
3
+ end
4
+
5
+ command = 'ruby -w -Ilib -Itest test/all.rb'
6
+ gemfiles = %w(ci/Gemfile.rails-3.x ci/Gemfile.rails-2.3.x ci/Gemfile.no-rails)
7
+
8
+ results = gemfiles.map do |gemfile|
9
+ puts "BUNDLE_GEMFILE=#{gemfile}"
10
+ ENV['BUNDLE_GEMFILE'] = gemfile
11
+
12
+ unless bundle_check
13
+ puts "bundle install"
14
+ system('bundle install')
15
+ end
16
+
17
+ puts command
18
+ system('ruby -w -Ilib -Itest test/all.rb')
19
+ end
20
+
21
+ exit(results.inject(true) { |a, b| a && b })
@@ -0,0 +1,72 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: version 0.0.1\n"
10
+ "POT-Creation-Date: 2009-02-26 19:50+0100\n"
11
+ "PO-Revision-Date: 2009-02-18 14:53+0100\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18
+
19
+ # #: app/helpers/translation_helper.rb:3
20
+ # msgid "%{relative_time} ago"
21
+ # msgstr "vor %{relative_time}"
22
+
23
+ #: app/views/cars/show.html.erb:5
24
+ msgid "Axis"
25
+ msgid_plural "Axis"
26
+ msgstr[0] "Achse"
27
+ msgstr[1] "Achsen"
28
+
29
+ #: app/controllers/cars_controller.rb:47
30
+ msgid "Car was successfully created."
31
+ msgstr "Auto wurde erfolgreich gespeichert"
32
+
33
+ #: app/controllers/cars_controller.rb:64
34
+ msgid "Car was successfully updated."
35
+ msgstr "Auto wurde erfolgreich aktualisiert"
36
+
37
+ #: app/views/cars/show.html.erb:1 locale/model_attributes.rb:3
38
+ msgid "Car|Model"
39
+ msgstr "Modell"
40
+
41
+ #: app/views/cars/show.html.erb:3 locale/model_attributes.rb:4
42
+ msgid "Car|Wheels count"
43
+ msgstr "Räderzahl"
44
+
45
+ #: app/views/cars/show.html.erb:7
46
+ msgid "Created"
47
+ msgstr "Erstellt"
48
+
49
+ #: app/views/cars/show.html.erb:9
50
+ msgid "Month"
51
+ msgstr "Monat"
52
+
53
+ #: locale/model_attributes.rb:2
54
+ msgid "car"
55
+ msgstr "Auto"
56
+
57
+ #: locale/testlog_phrases.rb:2
58
+ msgid "this is a dynamic translation which was found thorugh gettext_test_log!"
59
+ msgstr ""
60
+ "Dies ist eine dynamische Übersetzung, die durch gettext_test_log "
61
+ "gefunden wurde!"
62
+
63
+ #: app/views/cars/nowhere_really
64
+ msgid "Car|wheel"
65
+ msgid_plural "Car|wheels"
66
+ msgstr[0] "Rad"
67
+ msgstr[1] "Räder"
68
+
69
+ msgid "On %{count} wheel."
70
+ msgid_plural "On %{count} wheels."
71
+ msgstr[0] "Auf %{count} Achse."
72
+ msgstr[1] "Auf %{count} Achsen."
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ { :en => { :fuh => { :bah => "bas" } } }
@@ -0,0 +1,3 @@
1
+ en:
2
+ foo:
3
+ bar: baz
@@ -0,0 +1,113 @@
1
+ # encoding: utf-8
2
+
3
+ {
4
+ :af => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
5
+ :am => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
6
+ :ar => { :i18n => { :plural => { :keys => [:zero, :one, :two, :few, :many, :other], :rule => lambda { |n| n == 0 ? :zero : n == 1 ? :one : n == 2 ? :two : [3, 4, 5, 6, 7, 8, 9, 10].include?(n % 100) ? :few : [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99].include?(n % 100) ? :many : :other } } } },
7
+ :az => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
8
+ :be => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
9
+ :bg => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
10
+ :bh => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
11
+ :bn => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
12
+ :bo => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
13
+ :bs => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
14
+ :ca => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
15
+ :cs => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n) ? :few : :other } } } },
16
+ :cy => { :i18n => { :plural => { :keys => [:one, :two, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : n == 8 || n == 11 ? :many : :other } } } },
17
+ :da => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
18
+ :de => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
19
+ :dz => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
20
+ :el => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
21
+ :en => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
22
+ :eo => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
23
+ :es => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
24
+ :et => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
25
+ :eu => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
26
+ :fa => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
27
+ :fi => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
28
+ :fil => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
29
+ :fo => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
30
+ :fr => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n && n != 2 ? :one : :other } } } },
31
+ :fur => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
32
+ :fy => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
33
+ :ga => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
34
+ :gl => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
35
+ :gu => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
36
+ :guw => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
37
+ :ha => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
38
+ :he => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
39
+ :hi => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
40
+ :hr => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
41
+ :hu => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
42
+ :id => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
43
+ :is => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
44
+ :it => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
45
+ :iw => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
46
+ :ja => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
47
+ :jv => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
48
+ :ka => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
49
+ :km => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
50
+ :kn => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
51
+ :ko => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
52
+ :ku => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
53
+ :lb => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
54
+ :ln => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
55
+ :lt => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n % 10 == 1 && ![11, 12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100) ? :one : [2, 3, 4, 5, 6, 7, 8, 9].include?(n % 10) && ![11, 12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100) ? :few : :other } } } },
56
+ :lv => { :i18n => { :plural => { :keys => [:zero, :one, :other], :rule => lambda { |n| n == 0 ? :zero : n % 10 == 1 && n % 100 != 11 ? :one : :other } } } },
57
+ :mg => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
58
+ :mk => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n % 10 == 1 ? :one : :other } } } },
59
+ :ml => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
60
+ :mn => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
61
+ :mo => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : n == 0 ? :few : :other } } } },
62
+ :mr => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
63
+ :ms => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
64
+ :mt => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 0 || [2, 3, 4, 5, 6, 7, 8, 9, 10].include?(n % 100) ? :few : [11, 12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100) ? :many : :other } } } },
65
+ :my => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
66
+ :nah => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
67
+ :nb => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
68
+ :ne => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
69
+ :nl => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
70
+ :nn => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
71
+ :no => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
72
+ :nso => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
73
+ :om => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
74
+ :or => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
75
+ :pa => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
76
+ :pap => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
77
+ :pl => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) && ![22, 23, 24].include?(n % 100) ? :few : :other } } } },
78
+ :ps => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
79
+ :pt => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
80
+ :"pt-PT" => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
81
+ :ro => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : n == 0 ? :few : :other } } } },
82
+ :ru => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
83
+ :se => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
84
+ :sh => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
85
+ :sk => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n) ? :few : :other } } } },
86
+ :sl => { :i18n => { :plural => { :keys => [:one, :two, :few, :other], :rule => lambda { |n| n % 100 == 1 ? :one : n % 100 == 2 ? :two : [3, 4].include?(n % 100) ? :few : :other } } } },
87
+ :sma => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
88
+ :smi => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
89
+ :smj => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
90
+ :smn => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
91
+ :sms => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
92
+ :so => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
93
+ :sq => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
94
+ :sr => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
95
+ :sv => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
96
+ :sw => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
97
+ :ta => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
98
+ :te => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
99
+ :th => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
100
+ :ti => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
101
+ :tk => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
102
+ :tl => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
103
+ :to => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
104
+ :tr => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
105
+ :uk => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
106
+ :ur => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
107
+ :vi => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
108
+ :wa => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
109
+ :yo => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
110
+ :zh => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
111
+ :zu => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } }
112
+ }
113
+
@@ -0,0 +1,56 @@
1
+ $KCODE = 'u' if RUBY_VERSION <= '1.9'
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+
6
+ # Do not load the i18n gem from libraries like active_support.
7
+ #
8
+ # This is required for testing against Rails 2.3 because active_support/vendor.rb#24 tries
9
+ # to load I18n using the gem method. Instead, we want to test the local library of course.
10
+ alias :gem_for_ruby_19 :gem # for 1.9. gives a super ugly seg fault otherwise
11
+ def gem(gem_name, *version_requirements)
12
+ gem_name =='i18n' ? puts("skipping loading the i18n gem ...") : super
13
+ end
14
+
15
+ require 'bundler/setup'
16
+ require 'i18n'
17
+ require 'mocha'
18
+ require 'test_declarative'
19
+
20
+ class Test::Unit::TestCase
21
+ def teardown
22
+ I18n.locale = nil
23
+ I18n.default_locale = :en
24
+ I18n.load_path = []
25
+ I18n.available_locales = nil
26
+ I18n.backend = nil
27
+ end
28
+
29
+ def translations
30
+ I18n.backend.instance_variable_get(:@translations)
31
+ end
32
+
33
+ def store_translations(*args)
34
+ data = args.pop
35
+ locale = args.pop || :en
36
+ I18n.backend.store_translations(locale, data)
37
+ end
38
+
39
+ def locales_dir
40
+ File.dirname(__FILE__) + '/test_data/locales'
41
+ end
42
+ end
43
+
44
+ module Kernel
45
+ def setup_rufus_tokyo
46
+ require 'rufus/tokyo'
47
+ rescue LoadError => e
48
+ puts "can't use KeyValue backend because: #{e.message}"
49
+ end
50
+ end
51
+
52
+ Object.class_eval do
53
+ def meta_class
54
+ class << self; self; end
55
+ end
56
+ end unless Object.method_defined?(:meta_class)
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sayso-i18n
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.5.0.001
6
+ platform: ruby
7
+ authors:
8
+ - SaySo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-23 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activesupport
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 3.0.0
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3-ruby
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :development
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: mocha
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: test_declarative
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id004
60
+ description: New wave Internationalization support for Ruby - forked and gemified for sayso
61
+ email: sayso@truvolabs.com
62
+ executables: []
63
+
64
+ extensions: []
65
+
66
+ extra_rdoc_files: []
67
+
68
+ files:
69
+ - ci/Gemfile.no-rails
70
+ - ci/Gemfile.no-rails.lock
71
+ - ci/Gemfile.rails-2.3.x
72
+ - ci/Gemfile.rails-2.3.x.lock
73
+ - ci/Gemfile.rails-3.x
74
+ - ci/Gemfile.rails-3.x.lock
75
+ - lib/i18n/backend/base.rb
76
+ - lib/i18n/backend/cache.rb
77
+ - lib/i18n/backend/cascade.rb
78
+ - lib/i18n/backend/chain.rb
79
+ - lib/i18n/backend/fallbacks.rb
80
+ - lib/i18n/backend/flatten.rb
81
+ - lib/i18n/backend/flatten_yml.rb
82
+ - lib/i18n/backend/gettext.rb
83
+ - lib/i18n/backend/interpolation_compiler.rb
84
+ - lib/i18n/backend/key_value.rb
85
+ - lib/i18n/backend/memoize.rb
86
+ - lib/i18n/backend/metadata.rb
87
+ - lib/i18n/backend/pluralization.rb
88
+ - lib/i18n/backend/simple.rb
89
+ - lib/i18n/backend/transliterator.rb
90
+ - lib/i18n/backend.rb
91
+ - lib/i18n/config.rb
92
+ - lib/i18n/core_ext/hash.rb
93
+ - lib/i18n/core_ext/kernel/surpress_warnings.rb
94
+ - lib/i18n/core_ext/string/interpolate.rb
95
+ - lib/i18n/exceptions.rb
96
+ - lib/i18n/gettext/helpers.rb
97
+ - lib/i18n/gettext/po_parser.rb
98
+ - lib/i18n/gettext.rb
99
+ - lib/i18n/interpolate/ruby.rb
100
+ - lib/i18n/locale/fallbacks.rb
101
+ - lib/i18n/locale/tag/parents.rb
102
+ - lib/i18n/locale/tag/rfc4646.rb
103
+ - lib/i18n/locale/tag/simple.rb
104
+ - lib/i18n/locale/tag.rb
105
+ - lib/i18n/locale.rb
106
+ - lib/i18n/tests/basics.rb
107
+ - lib/i18n/tests/defaults.rb
108
+ - lib/i18n/tests/interpolation.rb
109
+ - lib/i18n/tests/link.rb
110
+ - lib/i18n/tests/localization/date.rb
111
+ - lib/i18n/tests/localization/date_time.rb
112
+ - lib/i18n/tests/localization/procs.rb
113
+ - lib/i18n/tests/localization/time.rb
114
+ - lib/i18n/tests/localization.rb
115
+ - lib/i18n/tests/lookup.rb
116
+ - lib/i18n/tests/pluralization.rb
117
+ - lib/i18n/tests/procs.rb
118
+ - lib/i18n/tests.rb
119
+ - lib/i18n/version.rb
120
+ - lib/i18n.rb
121
+ - test/all.rb
122
+ - test/api/all_features_test.rb
123
+ - test/api/cascade_test.rb
124
+ - test/api/chain_test.rb
125
+ - test/api/fallbacks_test.rb
126
+ - test/api/flatten_yml_test.rb
127
+ - test/api/key_value_test.rb
128
+ - test/api/memoize_test.rb
129
+ - test/api/pluralization_test.rb
130
+ - test/api/simple_test.rb
131
+ - test/backend/cache_test.rb
132
+ - test/backend/cascade_test.rb
133
+ - test/backend/chain_test.rb
134
+ - test/backend/exceptions_test.rb
135
+ - test/backend/fallbacks_test.rb
136
+ - test/backend/flatten_yml_test.rb
137
+ - test/backend/interpolation_compiler_test.rb
138
+ - test/backend/key_value_test.rb
139
+ - test/backend/memoize_test.rb
140
+ - test/backend/metadata_test.rb
141
+ - test/backend/pluralization_test.rb
142
+ - test/backend/simple_test.rb
143
+ - test/backend/transliterator_test.rb
144
+ - test/core_ext/hash_test.rb
145
+ - test/core_ext/string/interpolate_test.rb
146
+ - test/gettext/api_test.rb
147
+ - test/gettext/backend_test.rb
148
+ - test/i18n/exceptions_test.rb
149
+ - test/i18n/interpolate_test.rb
150
+ - test/i18n/load_path_test.rb
151
+ - test/i18n_test.rb
152
+ - test/locale/fallbacks_test.rb
153
+ - test/locale/tag/rfc4646_test.rb
154
+ - test/locale/tag/simple_test.rb
155
+ - test/run_all.rb
156
+ - test/test_data/locales/de.po
157
+ - test/test_data/locales/en.rb
158
+ - test/test_data/locales/en.yml
159
+ - test/test_data/locales/invalid/empty.yml
160
+ - test/test_data/locales/plurals.rb
161
+ - test/test_helper.rb
162
+ - README.textile
163
+ - MIT-LICENSE
164
+ - CHANGELOG.textile
165
+ has_rdoc: true
166
+ homepage: http://github.com/sayso/i18n
167
+ licenses: []
168
+
169
+ post_install_message:
170
+ rdoc_options: []
171
+
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: "0"
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ none: false
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: 1.3.5
186
+ requirements: []
187
+
188
+ rubyforge_project: "[none]"
189
+ rubygems_version: 1.6.2
190
+ signing_key:
191
+ specification_version: 3
192
+ summary: New wave Internationalization support for Ruby - forked and gemified for sayso
193
+ test_files: []
194
+