i18n-js 3.9.2 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +4 -0
  3. data/.github/FUNDING.yml +1 -1
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  5. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  8. data/.github/dependabot.yml +15 -0
  9. data/.github/workflows/ruby-tests.yml +73 -0
  10. data/.gitignore +13 -7
  11. data/.rubocop.yml +19 -0
  12. data/CHANGELOG.md +45 -561
  13. data/CODE_OF_CONDUCT.md +74 -0
  14. data/CONTRIBUTING.md +79 -0
  15. data/Gemfile +3 -0
  16. data/LICENSE.md +20 -0
  17. data/MIGRATING_FROM_V3_TO_V4.md +191 -0
  18. data/README.md +425 -951
  19. data/Rakefile +10 -20
  20. data/bin/release +81 -0
  21. data/exe/i18n +5 -0
  22. data/i18n-js.gemspec +51 -29
  23. data/lib/guard/i18n-js/templates/Guardfile +10 -0
  24. data/lib/guard/i18n-js/version.rb +13 -0
  25. data/lib/guard/i18n-js.rb +95 -0
  26. data/lib/i18n-js/clean_hash.rb +13 -0
  27. data/lib/i18n-js/cli/check_command.rb +17 -0
  28. data/lib/i18n-js/cli/command.rb +79 -0
  29. data/lib/i18n-js/cli/export_command.rb +95 -0
  30. data/lib/i18n-js/cli/init_command.rb +52 -0
  31. data/lib/i18n-js/cli/lint_scripts_command.rb +157 -0
  32. data/lib/i18n-js/cli/lint_translations_command.rb +155 -0
  33. data/lib/i18n-js/cli/plugins_command.rb +67 -0
  34. data/lib/i18n-js/cli/ui.rb +64 -0
  35. data/lib/i18n-js/cli/version_command.rb +18 -0
  36. data/lib/i18n-js/cli.rb +66 -0
  37. data/lib/i18n-js/embed_fallback_translations_plugin.rb +70 -0
  38. data/lib/i18n-js/export_files_plugin.rb +103 -0
  39. data/lib/i18n-js/lint.js +150645 -0
  40. data/lib/i18n-js/lint.ts +196 -0
  41. data/lib/i18n-js/listen.rb +96 -0
  42. data/lib/i18n-js/plugin.rb +103 -0
  43. data/lib/i18n-js/schema.rb +216 -0
  44. data/lib/i18n-js/sort_hash.rb +12 -0
  45. data/lib/i18n-js/version.rb +5 -0
  46. data/lib/i18n-js.rb +107 -1
  47. data/package.json +5 -20
  48. metadata +152 -198
  49. data/.editorconfig +0 -24
  50. data/.github/workflows/tests.yaml +0 -106
  51. data/.npmignore +0 -27
  52. data/Appraisals +0 -52
  53. data/app/assets/javascripts/i18n/filtered.js.erb +0 -23
  54. data/app/assets/javascripts/i18n/shims.js +0 -240
  55. data/app/assets/javascripts/i18n/translations.js +0 -3
  56. data/app/assets/javascripts/i18n.js +0 -1095
  57. data/gemfiles/i18n_0_6.gemfile +0 -7
  58. data/gemfiles/i18n_0_7.gemfile +0 -7
  59. data/gemfiles/i18n_0_8.gemfile +0 -7
  60. data/gemfiles/i18n_0_9.gemfile +0 -7
  61. data/gemfiles/i18n_1_0.gemfile +0 -7
  62. data/gemfiles/i18n_1_1.gemfile +0 -7
  63. data/gemfiles/i18n_1_10.gemfile +0 -7
  64. data/gemfiles/i18n_1_2.gemfile +0 -7
  65. data/gemfiles/i18n_1_3.gemfile +0 -7
  66. data/gemfiles/i18n_1_4.gemfile +0 -7
  67. data/gemfiles/i18n_1_5.gemfile +0 -7
  68. data/gemfiles/i18n_1_6.gemfile +0 -7
  69. data/gemfiles/i18n_1_7.gemfile +0 -7
  70. data/gemfiles/i18n_1_8.gemfile +0 -7
  71. data/gemfiles/i18n_1_9.gemfile +0 -7
  72. data/i18njs.png +0 -0
  73. data/lib/i18n/js/dependencies.rb +0 -67
  74. data/lib/i18n/js/engine.rb +0 -87
  75. data/lib/i18n/js/fallback_locales.rb +0 -70
  76. data/lib/i18n/js/formatters/base.rb +0 -25
  77. data/lib/i18n/js/formatters/js.rb +0 -39
  78. data/lib/i18n/js/formatters/json.rb +0 -13
  79. data/lib/i18n/js/middleware.rb +0 -82
  80. data/lib/i18n/js/private/config_store.rb +0 -31
  81. data/lib/i18n/js/private/hash_with_symbol_keys.rb +0 -36
  82. data/lib/i18n/js/segment.rb +0 -81
  83. data/lib/i18n/js/utils.rb +0 -91
  84. data/lib/i18n/js/version.rb +0 -7
  85. data/lib/i18n/js.rb +0 -274
  86. data/lib/rails/generators/i18n/js/config/config_generator.rb +0 -19
  87. data/lib/rails/generators/i18n/js/config/templates/i18n-js.yml +0 -27
  88. data/lib/tasks/export.rake +0 -8
  89. data/spec/fixtures/custom_path.yml +0 -5
  90. data/spec/fixtures/default.yml +0 -5
  91. data/spec/fixtures/erb.yml +0 -5
  92. data/spec/fixtures/except_condition.yml +0 -7
  93. data/spec/fixtures/js_available_locales_custom.yml +0 -1
  94. data/spec/fixtures/js_export_dir_custom.yml +0 -7
  95. data/spec/fixtures/js_export_dir_none.yml +0 -6
  96. data/spec/fixtures/js_extend_parent.yml +0 -6
  97. data/spec/fixtures/js_extend_segment.yml +0 -6
  98. data/spec/fixtures/js_file_per_locale.yml +0 -7
  99. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_default_locale_symbol.yml +0 -4
  100. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_hash.yml +0 -6
  101. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale.yml +0 -4
  102. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml +0 -4
  103. data/spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml +0 -4
  104. data/spec/fixtures/js_file_per_locale_without_fallbacks.yml +0 -4
  105. data/spec/fixtures/js_file_with_namespace_prefix_and_pretty_print.yml +0 -9
  106. data/spec/fixtures/js_sort_translation_keys_false.yml +0 -6
  107. data/spec/fixtures/js_sort_translation_keys_true.yml +0 -6
  108. data/spec/fixtures/json_only.yml +0 -18
  109. data/spec/fixtures/locales.yml +0 -133
  110. data/spec/fixtures/merge_plurals.yml +0 -6
  111. data/spec/fixtures/merge_plurals_with_no_overrides.yml +0 -4
  112. data/spec/fixtures/merge_plurals_with_partial_overrides.yml +0 -4
  113. data/spec/fixtures/millions.yml +0 -4
  114. data/spec/fixtures/multiple_conditions.yml +0 -7
  115. data/spec/fixtures/multiple_conditions_per_locale.yml +0 -7
  116. data/spec/fixtures/multiple_files.yml +0 -7
  117. data/spec/fixtures/no_config.yml +0 -2
  118. data/spec/fixtures/no_scope.yml +0 -4
  119. data/spec/fixtures/simple_scope.yml +0 -5
  120. data/spec/js/currency.spec.js +0 -62
  121. data/spec/js/current_locale.spec.js +0 -19
  122. data/spec/js/dates.spec.js +0 -276
  123. data/spec/js/defaults.spec.js +0 -31
  124. data/spec/js/extend.spec.js +0 -110
  125. data/spec/js/interpolation.spec.js +0 -124
  126. data/spec/js/jasmine/MIT.LICENSE +0 -20
  127. data/spec/js/jasmine/jasmine-html.js +0 -190
  128. data/spec/js/jasmine/jasmine.css +0 -166
  129. data/spec/js/jasmine/jasmine.js +0 -2476
  130. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  131. data/spec/js/json_parsable.spec.js +0 -14
  132. data/spec/js/locales.spec.js +0 -31
  133. data/spec/js/localization.spec.js +0 -78
  134. data/spec/js/numbers.spec.js +0 -174
  135. data/spec/js/placeholder.spec.js +0 -24
  136. data/spec/js/pluralization.spec.js +0 -228
  137. data/spec/js/prepare_options.spec.js +0 -41
  138. data/spec/js/require.js +0 -2083
  139. data/spec/js/specs.html +0 -49
  140. data/spec/js/specs_requirejs.html +0 -72
  141. data/spec/js/translate.spec.js +0 -304
  142. data/spec/js/translations.js +0 -188
  143. data/spec/js/utility_functions.spec.js +0 -20
  144. data/spec/ruby/i18n/js/fallback_locales_spec.rb +0 -84
  145. data/spec/ruby/i18n/js/segment_spec.rb +0 -286
  146. data/spec/ruby/i18n/js/utils_spec.rb +0 -138
  147. data/spec/ruby/i18n/js_spec.rb +0 -797
  148. data/spec/spec_helper.rb +0 -80
  149. data/yarn.lock +0 -138
data/spec/spec_helper.rb DELETED
@@ -1,80 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
-
4
- begin
5
- require 'simplecov'
6
- SimpleCov.start do
7
- add_filter 'spec'
8
- end
9
- rescue LoadError
10
- # SimpleCov ain't available - continue
11
- end
12
-
13
- if ENV["TRAVIS"]
14
- require "coveralls"
15
- Coveralls.wear!("rails")
16
- end
17
-
18
- require "i18n"
19
- require "json"
20
-
21
- require "i18n/js"
22
-
23
- require "rspec"
24
-
25
- module Helpers
26
- # Set the configuration as the current one
27
- def set_config(path)
28
- config_file_path = File.dirname(__FILE__) + "/fixtures/#{path}"
29
- allow(I18n::JS).to receive_messages(
30
- :config_file_exists? => true,
31
- :config_file_path => config_file_path,
32
- )
33
- end
34
-
35
- # Shortcut to I18n::JS.translations
36
- def translations
37
- I18n::JS.translations
38
- end
39
-
40
- def file_should_exist(name)
41
- file_path = File.join(temp_path, name)
42
- expect(File.file?(file_path)).to eq(true)
43
- end
44
-
45
- def temp_path(file_name = "")
46
- File.expand_path("../../tmp/i18n-js/#{file_name}", __FILE__)
47
- end
48
-
49
-
50
- def self.included(base)
51
- base.let(:backend_class_with_fallbacks) do
52
- klass = Class.new(I18n::Backend::Simple)
53
- klass.send(:include, I18n::Backend::Fallbacks)
54
- klass
55
- end
56
- end
57
- end
58
-
59
- RSpec.configure do |config|
60
- config.before do
61
- I18n.load_path = [File.dirname(__FILE__) + "/fixtures/locales.yml"]
62
- FileUtils.rm_rf(temp_path)
63
- end
64
-
65
- config.after do
66
- FileUtils.rm_rf(temp_path)
67
- I18n::JS::Private::ConfigStore.instance.flush_cache
68
- end
69
-
70
- config.include Helpers
71
-
72
- # Remove deprecation warnings
73
- config.expect_with :rspec do |c|
74
- c.syntax = [:expect]
75
- end
76
- config.mock_with :rspec do |c|
77
- c.syntax = [:expect]
78
- end
79
- end
80
-
data/yarn.lock DELETED
@@ -1,138 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-
5
- balanced-match@^1.0.0:
6
- version "1.0.0"
7
- resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
8
-
9
- brace-expansion@^1.1.7:
10
- version "1.1.11"
11
- resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
12
- dependencies:
13
- balanced-match "^1.0.0"
14
- concat-map "0.0.1"
15
-
16
- coffeescript@~1.12.7:
17
- version "1.12.7"
18
- resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-1.12.7.tgz#e57ee4c4867cf7f606bfc4a0f2d550c0981ddd27"
19
- integrity sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA==
20
-
21
- concat-map@0.0.1:
22
- version "0.0.1"
23
- resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
24
-
25
- fs.realpath@^1.0.0:
26
- version "1.0.0"
27
- resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
28
-
29
- gaze@~1.1.2:
30
- version "1.1.3"
31
- resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a"
32
- dependencies:
33
- globule "^1.0.0"
34
-
35
- glob@~7.1.1:
36
- version "7.1.2"
37
- resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
38
- dependencies:
39
- fs.realpath "^1.0.0"
40
- inflight "^1.0.4"
41
- inherits "2"
42
- minimatch "^3.0.4"
43
- once "^1.3.0"
44
- path-is-absolute "^1.0.0"
45
-
46
- globule@^1.0.0:
47
- version "1.2.1"
48
- resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d"
49
- dependencies:
50
- glob "~7.1.1"
51
- lodash "~4.17.10"
52
- minimatch "~3.0.2"
53
-
54
- growl@^1.10.5:
55
- version "1.10.5"
56
- resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
57
- integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==
58
-
59
- inflight@^1.0.4:
60
- version "1.0.6"
61
- resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
62
- dependencies:
63
- once "^1.3.0"
64
- wrappy "1"
65
-
66
- inherits@2:
67
- version "2.0.3"
68
- resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
69
-
70
- jasmine-growl-reporter@~2.0.0:
71
- version "2.0.0"
72
- resolved "https://registry.yarnpkg.com/jasmine-growl-reporter/-/jasmine-growl-reporter-2.0.0.tgz#4943a2481193d66a8a68ee2f38b6c360fb037859"
73
- integrity sha512-RYwVfPaGgxQQSHDOt6jQ99/KAkFQ/Fiwg/AzBS+uO9A4UhGhxb7hwXaUUSU/Zs0MxBoFNqmIRC+7P4/+5O3lXg==
74
- dependencies:
75
- growl "^1.10.5"
76
-
77
- jasmine-node@^3.0.0:
78
- version "3.0.0"
79
- resolved "https://registry.yarnpkg.com/jasmine-node/-/jasmine-node-3.0.0.tgz#f12b6fdd24633402ec23e8ea6fef6ffbcb464f90"
80
- integrity sha512-vUa5Q7bQYwHHqi6FlJYndiKqZp+d+c3MKe0QUMwwrC4JRmoRV3zkg0buxB/uQ6qLh0NO34TNstpAnvaZ6xGlAA==
81
- dependencies:
82
- coffeescript "~1.12.7"
83
- gaze "~1.1.2"
84
- jasmine-growl-reporter "~2.0.0"
85
- jasmine-reporters "~1.0.0"
86
- mkdirp "~0.3.5"
87
- requirejs "~2.3.6"
88
- underscore "~1.9.1"
89
- walkdir "~0.0.12"
90
-
91
- jasmine-reporters@~1.0.0:
92
- version "1.0.2"
93
- resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-1.0.2.tgz#ab613ed5977dc7487e85b3c12f6a8ea8db2ade31"
94
- dependencies:
95
- mkdirp "~0.3.5"
96
-
97
- lodash@~4.17.10:
98
- version "4.17.21"
99
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
100
-
101
- minimatch@^3.0.4, minimatch@~3.0.2:
102
- version "3.0.4"
103
- resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
104
- dependencies:
105
- brace-expansion "^1.1.7"
106
-
107
- mkdirp@~0.3.5:
108
- version "0.3.5"
109
- resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7"
110
-
111
- once@^1.3.0:
112
- version "1.4.0"
113
- resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
114
- dependencies:
115
- wrappy "1"
116
-
117
- path-is-absolute@^1.0.0:
118
- version "1.0.1"
119
- resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
120
-
121
- requirejs@~2.3.6:
122
- version "2.3.6"
123
- resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.6.tgz#e5093d9601c2829251258c0b9445d4d19fa9e7c9"
124
- integrity sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==
125
-
126
- underscore@~1.9.1:
127
- version "1.9.2"
128
- resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.2.tgz#0c8d6f536d6f378a5af264a72f7bec50feb7cf2f"
129
- integrity sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ==
130
-
131
- walkdir@~0.0.12:
132
- version "0.0.12"
133
- resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.0.12.tgz#2f24f1ade64aab1e458591d4442c8868356e9281"
134
- integrity sha512-HFhaD4mMWPzFSqhpyDG48KDdrjfn409YQuVW7ckZYhW4sE87mYtWifdB/+73RA7+p4s4K18n5Jfx1kHthE1gBw==
135
-
136
- wrappy@1:
137
- version "1.0.2"
138
- resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"