i18n-js 3.2.1 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +4 -0
  3. data/.github/FUNDING.yml +3 -0
  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 -386
  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 +439 -791
  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 +153 -181
  49. data/.editorconfig +0 -24
  50. data/.npmignore +0 -27
  51. data/.travis.yml +0 -36
  52. data/Appraisals +0 -32
  53. data/app/assets/javascripts/i18n/filtered.js.erb +0 -23
  54. data/app/assets/javascripts/i18n/shims.js +0 -208
  55. data/app/assets/javascripts/i18n/translations.js +0 -3
  56. data/app/assets/javascripts/i18n.js +0 -1077
  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_2.gemfile +0 -7
  64. data/gemfiles/i18n_1_3.gemfile +0 -7
  65. data/gemfiles/i18n_1_4.gemfile +0 -7
  66. data/gemfiles/i18n_1_5.gemfile +0 -7
  67. data/lib/i18n/js/dependencies.rb +0 -59
  68. data/lib/i18n/js/engine.rb +0 -87
  69. data/lib/i18n/js/fallback_locales.rb +0 -70
  70. data/lib/i18n/js/formatters/base.rb +0 -23
  71. data/lib/i18n/js/formatters/js.rb +0 -31
  72. data/lib/i18n/js/formatters/json.rb +0 -13
  73. data/lib/i18n/js/middleware.rb +0 -82
  74. data/lib/i18n/js/private/hash_with_symbol_keys.rb +0 -36
  75. data/lib/i18n/js/segment.rb +0 -75
  76. data/lib/i18n/js/utils.rb +0 -65
  77. data/lib/i18n/js/version.rb +0 -7
  78. data/lib/i18n/js.rb +0 -259
  79. data/lib/rails/generators/i18n/js/config/config_generator.rb +0 -19
  80. data/lib/rails/generators/i18n/js/config/templates/i18n-js.yml +0 -27
  81. data/lib/tasks/export.rake +0 -8
  82. data/spec/fixtures/custom_path.yml +0 -5
  83. data/spec/fixtures/default.yml +0 -5
  84. data/spec/fixtures/erb.yml +0 -5
  85. data/spec/fixtures/except_condition.yml +0 -7
  86. data/spec/fixtures/js_export_dir_custom.yml +0 -7
  87. data/spec/fixtures/js_export_dir_none.yml +0 -6
  88. data/spec/fixtures/js_extend_parent.yml +0 -6
  89. data/spec/fixtures/js_extend_segment.yml +0 -6
  90. data/spec/fixtures/js_file_per_locale.yml +0 -7
  91. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_default_locale_symbol.yml +0 -4
  92. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_hash.yml +0 -6
  93. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale.yml +0 -4
  94. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml +0 -4
  95. data/spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml +0 -4
  96. data/spec/fixtures/js_file_per_locale_without_fallbacks.yml +0 -4
  97. data/spec/fixtures/js_file_with_namespace_and_pretty_print.yml +0 -7
  98. data/spec/fixtures/js_sort_translation_keys_false.yml +0 -6
  99. data/spec/fixtures/js_sort_translation_keys_true.yml +0 -6
  100. data/spec/fixtures/json_only.yml +0 -18
  101. data/spec/fixtures/locales.yml +0 -95
  102. data/spec/fixtures/merge_plurals.yml +0 -6
  103. data/spec/fixtures/multiple_conditions.yml +0 -7
  104. data/spec/fixtures/multiple_conditions_per_locale.yml +0 -7
  105. data/spec/fixtures/multiple_files.yml +0 -7
  106. data/spec/fixtures/no_config.yml +0 -2
  107. data/spec/fixtures/no_scope.yml +0 -4
  108. data/spec/fixtures/simple_scope.yml +0 -5
  109. data/spec/js/currency.spec.js +0 -62
  110. data/spec/js/current_locale.spec.js +0 -19
  111. data/spec/js/dates.spec.js +0 -265
  112. data/spec/js/defaults.spec.js +0 -31
  113. data/spec/js/extend.spec.js +0 -110
  114. data/spec/js/interpolation.spec.js +0 -124
  115. data/spec/js/jasmine/MIT.LICENSE +0 -20
  116. data/spec/js/jasmine/jasmine-html.js +0 -190
  117. data/spec/js/jasmine/jasmine.css +0 -166
  118. data/spec/js/jasmine/jasmine.js +0 -2476
  119. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  120. data/spec/js/locales.spec.js +0 -31
  121. data/spec/js/localization.spec.js +0 -48
  122. data/spec/js/numbers.spec.js +0 -170
  123. data/spec/js/placeholder.spec.js +0 -24
  124. data/spec/js/pluralization.spec.js +0 -211
  125. data/spec/js/prepare_options.spec.js +0 -41
  126. data/spec/js/require.js +0 -2083
  127. data/spec/js/specs.html +0 -49
  128. data/spec/js/specs_requirejs.html +0 -72
  129. data/spec/js/translate.spec.js +0 -284
  130. data/spec/js/translations.js +0 -163
  131. data/spec/js/utility_functions.spec.js +0 -20
  132. data/spec/ruby/i18n/js/fallback_locales_spec.rb +0 -84
  133. data/spec/ruby/i18n/js/segment_spec.rb +0 -219
  134. data/spec/ruby/i18n/js/utils_spec.rb +0 -106
  135. data/spec/ruby/i18n/js_spec.rb +0 -663
  136. data/spec/spec_helper.rb +0 -79
  137. data/yarn.lock +0 -131
data/spec/spec_helper.rb DELETED
@@ -1,79 +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
- end
68
-
69
- config.include Helpers
70
-
71
- # Remove deprecation warnings
72
- config.expect_with :rspec do |c|
73
- c.syntax = [:expect]
74
- end
75
- config.mock_with :rspec do |c|
76
- c.syntax = [:expect]
77
- end
78
- end
79
-
data/yarn.lock DELETED
@@ -1,131 +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.0.1:
17
- version "2.3.1"
18
- resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.3.1.tgz#a25f69c251d25805c9842e57fc94bfc453ef6aed"
19
-
20
- concat-map@0.0.1:
21
- version "0.0.1"
22
- resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
23
-
24
- fs.realpath@^1.0.0:
25
- version "1.0.0"
26
- resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
27
-
28
- gaze@~1.1.2:
29
- version "1.1.3"
30
- resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a"
31
- dependencies:
32
- globule "^1.0.0"
33
-
34
- glob@~7.1.1:
35
- version "7.1.2"
36
- resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
37
- dependencies:
38
- fs.realpath "^1.0.0"
39
- inflight "^1.0.4"
40
- inherits "2"
41
- minimatch "^3.0.4"
42
- once "^1.3.0"
43
- path-is-absolute "^1.0.0"
44
-
45
- globule@^1.0.0:
46
- version "1.2.1"
47
- resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d"
48
- dependencies:
49
- glob "~7.1.1"
50
- lodash "~4.17.10"
51
- minimatch "~3.0.2"
52
-
53
- growl@^1.10.2:
54
- version "1.10.5"
55
- resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
56
-
57
- inflight@^1.0.4:
58
- version "1.0.6"
59
- resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
60
- dependencies:
61
- once "^1.3.0"
62
- wrappy "1"
63
-
64
- inherits@2:
65
- version "2.0.3"
66
- resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
67
-
68
- jasmine-growl-reporter@~1.0.1:
69
- version "1.0.1"
70
- resolved "https://registry.yarnpkg.com/jasmine-growl-reporter/-/jasmine-growl-reporter-1.0.1.tgz#375306cef1fbf6357ad7913ca0358aa2285d6d39"
71
- dependencies:
72
- growl "^1.10.2"
73
-
74
- jasmine-node@^1.14.5:
75
- version "1.15.0"
76
- resolved "https://registry.yarnpkg.com/jasmine-node/-/jasmine-node-1.15.0.tgz#d5e9a92623c111f55e4b83ff2ab0407ddbc2a5b7"
77
- dependencies:
78
- coffeescript ">=1.0.1"
79
- gaze "~1.1.2"
80
- jasmine-growl-reporter "~1.0.1"
81
- jasmine-reporters "~1.0.0"
82
- mkdirp "~0.3.5"
83
- requirejs ">=0.27.1"
84
- underscore ">= 1.3.1"
85
- walkdir ">= 0.0.1"
86
-
87
- jasmine-reporters@~1.0.0:
88
- version "1.0.2"
89
- resolved "https://registry.yarnpkg.com/jasmine-reporters/-/jasmine-reporters-1.0.2.tgz#ab613ed5977dc7487e85b3c12f6a8ea8db2ade31"
90
- dependencies:
91
- mkdirp "~0.3.5"
92
-
93
- lodash@~4.17.10:
94
- version "4.17.10"
95
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
96
-
97
- minimatch@^3.0.4, minimatch@~3.0.2:
98
- version "3.0.4"
99
- resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
100
- dependencies:
101
- brace-expansion "^1.1.7"
102
-
103
- mkdirp@~0.3.5:
104
- version "0.3.5"
105
- resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7"
106
-
107
- once@^1.3.0:
108
- version "1.4.0"
109
- resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
110
- dependencies:
111
- wrappy "1"
112
-
113
- path-is-absolute@^1.0.0:
114
- version "1.0.1"
115
- resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
116
-
117
- requirejs@>=0.27.1:
118
- version "2.3.5"
119
- resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.5.tgz#617b9acbbcb336540ef4914d790323a8d4b861b0"
120
-
121
- "underscore@>= 1.3.1":
122
- version "1.9.1"
123
- resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961"
124
-
125
- "walkdir@>= 0.0.1":
126
- version "0.0.12"
127
- resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.0.12.tgz#2f24f1ade64aab1e458591d4442c8868356e9281"
128
-
129
- wrappy@1:
130
- version "1.0.2"
131
- resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"