i18n-js 3.3.0 → 4.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) 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 +47 -410
  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 +192 -0
  18. data/README.md +439 -793
  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 +159 -0
  32. data/lib/i18n-js/cli/lint_translations_command.rb +157 -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 -182
  49. data/.editorconfig +0 -24
  50. data/.npmignore +0 -27
  51. data/.travis.yml +0 -37
  52. data/Appraisals +0 -36
  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 -1091
  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/gemfiles/i18n_1_6.gemfile +0 -7
  68. data/lib/i18n/js/dependencies.rb +0 -63
  69. data/lib/i18n/js/engine.rb +0 -87
  70. data/lib/i18n/js/fallback_locales.rb +0 -70
  71. data/lib/i18n/js/formatters/base.rb +0 -23
  72. data/lib/i18n/js/formatters/js.rb +0 -31
  73. data/lib/i18n/js/formatters/json.rb +0 -13
  74. data/lib/i18n/js/middleware.rb +0 -82
  75. data/lib/i18n/js/private/hash_with_symbol_keys.rb +0 -36
  76. data/lib/i18n/js/segment.rb +0 -75
  77. data/lib/i18n/js/utils.rb +0 -65
  78. data/lib/i18n/js/version.rb +0 -7
  79. data/lib/i18n/js.rb +0 -259
  80. data/lib/rails/generators/i18n/js/config/config_generator.rb +0 -19
  81. data/lib/rails/generators/i18n/js/config/templates/i18n-js.yml +0 -27
  82. data/lib/tasks/export.rake +0 -8
  83. data/spec/fixtures/custom_path.yml +0 -5
  84. data/spec/fixtures/default.yml +0 -5
  85. data/spec/fixtures/erb.yml +0 -5
  86. data/spec/fixtures/except_condition.yml +0 -7
  87. data/spec/fixtures/js_export_dir_custom.yml +0 -7
  88. data/spec/fixtures/js_export_dir_none.yml +0 -6
  89. data/spec/fixtures/js_extend_parent.yml +0 -6
  90. data/spec/fixtures/js_extend_segment.yml +0 -6
  91. data/spec/fixtures/js_file_per_locale.yml +0 -7
  92. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_default_locale_symbol.yml +0 -4
  93. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_hash.yml +0 -6
  94. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale.yml +0 -4
  95. data/spec/fixtures/js_file_per_locale_with_fallbacks_as_locale_without_fallback_translations.yml +0 -4
  96. data/spec/fixtures/js_file_per_locale_with_fallbacks_enabled.yml +0 -4
  97. data/spec/fixtures/js_file_per_locale_without_fallbacks.yml +0 -4
  98. data/spec/fixtures/js_file_with_namespace_and_pretty_print.yml +0 -7
  99. data/spec/fixtures/js_sort_translation_keys_false.yml +0 -6
  100. data/spec/fixtures/js_sort_translation_keys_true.yml +0 -6
  101. data/spec/fixtures/json_only.yml +0 -18
  102. data/spec/fixtures/locales.yml +0 -95
  103. data/spec/fixtures/merge_plurals.yml +0 -6
  104. data/spec/fixtures/multiple_conditions.yml +0 -7
  105. data/spec/fixtures/multiple_conditions_per_locale.yml +0 -7
  106. data/spec/fixtures/multiple_files.yml +0 -7
  107. data/spec/fixtures/no_config.yml +0 -2
  108. data/spec/fixtures/no_scope.yml +0 -4
  109. data/spec/fixtures/simple_scope.yml +0 -5
  110. data/spec/js/currency.spec.js +0 -62
  111. data/spec/js/current_locale.spec.js +0 -19
  112. data/spec/js/dates.spec.js +0 -275
  113. data/spec/js/defaults.spec.js +0 -31
  114. data/spec/js/extend.spec.js +0 -110
  115. data/spec/js/interpolation.spec.js +0 -124
  116. data/spec/js/jasmine/MIT.LICENSE +0 -20
  117. data/spec/js/jasmine/jasmine-html.js +0 -190
  118. data/spec/js/jasmine/jasmine.css +0 -166
  119. data/spec/js/jasmine/jasmine.js +0 -2476
  120. data/spec/js/jasmine/jasmine_favicon.png +0 -0
  121. data/spec/js/locales.spec.js +0 -31
  122. data/spec/js/localization.spec.js +0 -54
  123. data/spec/js/numbers.spec.js +0 -170
  124. data/spec/js/placeholder.spec.js +0 -24
  125. data/spec/js/pluralization.spec.js +0 -211
  126. data/spec/js/prepare_options.spec.js +0 -41
  127. data/spec/js/require.js +0 -2083
  128. data/spec/js/specs.html +0 -49
  129. data/spec/js/specs_requirejs.html +0 -72
  130. data/spec/js/translate.spec.js +0 -284
  131. data/spec/js/translations.js +0 -163
  132. data/spec/js/utility_functions.spec.js +0 -20
  133. data/spec/ruby/i18n/js/fallback_locales_spec.rb +0 -84
  134. data/spec/ruby/i18n/js/segment_spec.rb +0 -219
  135. data/spec/ruby/i18n/js/utils_spec.rb +0 -106
  136. data/spec/ruby/i18n/js_spec.rb +0 -663
  137. data/spec/spec_helper.rb +0 -79
  138. data/yarn.lock +0 -131
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e499400b911829bf876432a25d3bbb1e5c55af10e5cedd2fdbf06a88145e8f3
4
- data.tar.gz: '0893d97d2e483f17c8c9a3af79227e6808a01a35275e10fceadc3b8ad507f70d'
3
+ metadata.gz: '08fcf5b6b9e3cff755d11708a88e88cc8d30609251cba16f52e396a86014ac85'
4
+ data.tar.gz: 90b3fa30d3e6115fe76f81b5621caba070160cf585890f122aa8f646ee10fd2e
5
5
  SHA512:
6
- metadata.gz: 66cc8573871132c0af819c87ffb10bf0e918799da4cd77aa01fb2298c422e7c5ae3f92409ae55575215360abba759b65d7410e9e0c1077dd4d75594cd5c1196e
7
- data.tar.gz: e4072b5b511a0b39b875dc03258926afc0cc5fe7f512054efcf05ebc9b8df67ada3c937cfe4ce9902dde6a61f87aed2240c971c24f990ae07c8b1309df5a15dc
6
+ metadata.gz: 02d7a1a0d46b452727465a35cc9a9c46f4e8fe3d0baee2680e75d70fd6512972c7a28481795f9d0a07295612bd8553b932fb27fae2e86f83adc39e4d8aec5209
7
+ data.tar.gz: 9987a9679a3aa39f50f70e4b7b67469c2c7549b61b738f3104b837119a1afeb253e932119f24bdb39f29ffdb9b1840aa4f9b20035d1a70f71e51cfc8f0310b03
@@ -0,0 +1,4 @@
1
+ # You can read more about CODEOWNERS at
2
+ # https://help.github.com/github/creating-cloning-and-archiving-repositories/about-code-owners
3
+
4
+ * @fnando
@@ -0,0 +1,3 @@
1
+ ---
2
+ github: [fnando]
3
+ custom: ["https://paypal.me/nandovieira/🍕"]
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: "🐛 Bug Report"
3
+ about: Report a reproducible bug or regression.
4
+ title: 'Bug: '
5
+ labels: 'Status: Unconfirmed'
6
+
7
+ ---
8
+
9
+ <!--
10
+ - Please provide a clear and concise description of what the bug is.
11
+ - If possible, add an example reproducing your issue.
12
+ - Please test using the latest version of i18n-js
13
+ to make sure your issue has not already been fixed.
14
+ -->
15
+
16
+ ## Description
17
+
18
+ [Add bug description here]
19
+
20
+ ## How to reproduce
21
+
22
+ [Add steps on how to reproduce this issue]
23
+
24
+ ## What do you expect
25
+
26
+ [Describe what do you expect to happen]
27
+
28
+ ## What happened instead
29
+
30
+ [Describe the actual results]
31
+
32
+ ## Software:
33
+
34
+ - Gem version: [Add gem version here]
35
+ - Ruby version: [Add version here]
36
+
37
+ ## Full backtrace
38
+
39
+ ```text
40
+ [Paste full backtrace here]
41
+ ```
@@ -0,0 +1,5 @@
1
+ ---
2
+ contact_links:
3
+ - name: "🤨 Q&A"
4
+ url: https://github.com/fnando/i18n-js/discussions/new?category=q-a
5
+ about: Have a question? Ask it away here!
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: "💡 Feature request"
3
+ about: Have an idea that may be useful? Make a suggestion!
4
+ title: 'Feature Request: '
5
+ labels: 'Feature request'
6
+
7
+ ---
8
+
9
+ ## Description
10
+
11
+ _A clear and concise description of what the problem is._
12
+
13
+ ## Describe the solution
14
+
15
+ _A clear and concise description of what you want to happen._
16
+
17
+ ## Alternatives you considered
18
+
19
+ _A clear and concise description of any alternative solutions or features you've considered._
20
+
21
+ ## Additional context
22
+
23
+ _Add any other context, screenshots, links, etc about the feature request here._
@@ -0,0 +1,38 @@
1
+ <!--
2
+ If you're making a doc PR or something tiny where the below is irrelevant,
3
+ delete this template and use a short description, but in your description aim to
4
+ include both what the change is, and why it is being made, with enough context
5
+ for anyone to understand.
6
+ -->
7
+
8
+ <details>
9
+ <summary>PR Checklist</summary>
10
+
11
+ ### PR Structure
12
+
13
+ - [ ] This PR has reasonably narrow scope (if not, break it down into smaller
14
+ PRs).
15
+ - [ ] This PR avoids mixing refactoring changes with feature changes (split into
16
+ two PRs otherwise).
17
+ - [ ] This PR's title starts is concise and descriptive.
18
+
19
+ ### Thoroughness
20
+
21
+ - [ ] This PR adds tests for the most critical parts of the new functionality or
22
+ fixes.
23
+ - [ ] I've updated any docs, `.md` files, etc… affected by this change.
24
+
25
+ </details>
26
+
27
+ ### What
28
+
29
+ [TODO: Short statement about what is changing.]
30
+
31
+ ### Why
32
+
33
+ [TODO: Why this change is being made. Include any context required to understand
34
+ the why.]
35
+
36
+ ### Known limitations
37
+
38
+ [TODO or N/A]
@@ -0,0 +1,15 @@
1
+ ---
2
+ # Documentation:
3
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
4
+
5
+ version: 2
6
+ updates:
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
11
+
12
+ - package-ecosystem: "bundler"
13
+ directory: "/"
14
+ schedule:
15
+ interval: "daily"
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: ruby-tests
3
+
4
+ on:
5
+ pull_request_target:
6
+ push:
7
+ workflow_dispatch:
8
+ inputs: {}
9
+
10
+ jobs:
11
+ build:
12
+ name:
13
+ Tests with Ruby ${{ matrix.ruby }}, Node ${{ matrix.node }} and ${{
14
+ matrix.gemfile }}
15
+ runs-on: "ubuntu-latest"
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: ["2.7", "3.0", "3.1"]
20
+ node: ["16", "18"]
21
+ gemfile:
22
+ - Gemfile
23
+ if: |
24
+ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target' ||
25
+ github.actor != 'dependabot[bot]'
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+
30
+ - uses: actions/cache@v3
31
+ id: bundler-cache
32
+ with:
33
+ path: vendor/bundle
34
+ key: >
35
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{
36
+ hashFiles(matrix.gemfile) }}
37
+
38
+ - uses: actions/cache@v3
39
+ id: npm-cache
40
+ with:
41
+ path: vendor/bundle
42
+ key: >
43
+ ${{ runner.os }}-${{ matrix.node }}-npm-${{
44
+ hashFiles('package.json') }}
45
+
46
+ - name: Set up Node
47
+ uses: actions/setup-node@v3.6.0
48
+ with:
49
+ node-version: ${{ matrix.node }}
50
+
51
+ - name: Install npm dependencies
52
+ run: |
53
+ yarn install
54
+
55
+ - name: Set up Ruby
56
+ uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ${{ matrix.ruby }}
59
+
60
+ - name: Install gem dependencies
61
+ env:
62
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
63
+ run: |
64
+ gem install bundler
65
+ bundle config path vendor/bundle
66
+ bundle update --jobs 4 --retry 3
67
+
68
+ - name: Run Tests
69
+ env:
70
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
71
+ run: |
72
+ yarn compile
73
+ bundle exec rake
data/.gitignore CHANGED
@@ -1,7 +1,13 @@
1
- pkg
2
- node_modules
3
- Gemfile.lock
4
- .idea/
5
- coverage/
6
- gemfiles/*.gemfile.lock
7
- gemfiles/.bundle
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
10
+ *.log
11
+ *.lock
12
+ /lib/**/*.js
13
+ /test/output
data/.rubocop.yml ADDED
@@ -0,0 +1,19 @@
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+ NewCops: enable
8
+ Exclude:
9
+ - tmp/**/*
10
+ - vendor/**/*
11
+ - gemfiles/**/*
12
+
13
+ Naming/FileName:
14
+ Exclude:
15
+ - lib/i18n-js.rb
16
+ - lib/guard/i18n-js.rb
17
+
18
+ Style/PerlBackrefs:
19
+ Enabled: false