extract_i18n 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a073e9f6b13d0ca1010d71892c5c5d990b769cee22481f02ae1d79e170869c99
4
- data.tar.gz: 88056408f7af54d8e896665d99ca0b64737075d8452d1c4e244111b3d9043dc7
3
+ metadata.gz: d821da5a501918ce7aab427aeeb58ba4da863e1f87b4d846e256753301f55fcc
4
+ data.tar.gz: ab6d26c92aa2ae78d15fe1e802fb6024febf78d281c07117e6b0793aa369a997
5
5
  SHA512:
6
- metadata.gz: bf5c0ac83c7b392f7813469a9023f8f9ee03308e35326f94cbf95a3c7f1ab628b62a4aaaf8aa004f34f4e1a4b184fa003116fafaa666c337055e33dca229fae3
7
- data.tar.gz: 508b44e381c020159a03260b2d09421573c8a87a515dbbce5878a382fff3947d1982d8617773c52f41593dd7b2f1df1002784ca74909585165714dae65e1aad9
6
+ metadata.gz: 396e63617070e13ee79c0353e5c847289d19e9b7643d6897ea14af84740b86232759ff4edea52584431b713eb4c4d1a7b8f30fe734ab936a95b06860af909233
7
+ data.tar.gz: 5808700e8db2e02eea5f62c04804d68613ed8a2f711ca71976a3acd4c0eda04a1ab57fbb77bb61f44554ab8d16142451507fa8588df7451a8e5f34abde02f340
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,14 @@
1
+ # Contributing Guide
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/extract_i18n.svg)](https://badge.fury.io/rb/extract_i18n)
4
+
5
+ ## Workflow
6
+ - fork the repository and setup the environment
7
+ - create a new branch: `feature/xxx`, `fix/xxx`
8
+ - commit codes and tests to finish the feature or bug fix
9
+ - push to remote and create a pull request
10
+
11
+ ## Environment setup
12
+ - use ruby version: 2.6
13
+ - install dependencies: `bundle install`
14
+ - make sure the test passed: `bundle exec rspec`
data/README.md CHANGED
@@ -17,12 +17,16 @@ This Gem **supports** the following source files:
17
17
  - Caveats: because of limitations of the HTML/XML parser it will slightly transform the HTML, for example, self closing tags are expanded (e.g. ``<Component />`` will become ``<Component></Component>``). Also multi-line arrangements of attributes, tags etc. might produce unexpected results, so make sure to use Git and diff the result.
18
18
  - Vue Pug views
19
19
  - Pug is very similar to slim and thus relatively well extractable via Regexp.
20
+ - Javascript string Literals by vendoring a small **nodeJS** script in ``js/find_string_tokens.js`` (requires node16+).
21
+ - Vue: Literal strings in script block (via bundled nodejs file)
22
+ - JS/TS: Literal strings
20
23
  - ERB views
21
24
  - by vendoring/extending https://github.com/ProGM/i18n-html_extractor (MIT License)
22
25
 
23
26
  CURRENTLY THERE IS **NO SUPPORT** FOR:
24
27
 
25
28
  - haml ( integrating https://github.com/shaiguitar/haml-i18n-extractor)
29
+ - JS: Template-Literals
26
30
 
27
31
  But I am open to integrating PRs for those!
28
32
 
@@ -49,6 +53,14 @@ extract-i18n --locale de --yaml config/locales/unsorted.de.yml app/views/user
49
53
  If you prefer relative keys in slim views use ``--slim-relative``, e.g. ``t('.title')`` instead of ``t('users.index.title')``.
50
54
  I prefer absolute keys, as it makes copy pasting/ moving files much safer.
51
55
 
56
+ To extract Vue/JS files, we usually put them in a namespace ``js.*`` and handle them with i18n-tasks as well, so to extract Vue-Components, or plain JS files:
57
+
58
+ ```
59
+ extract-i18n --locale de --yaml config/locales/unsorted.de.yml -n js app/javascript/components/Foobar.vue
60
+ ```
61
+
62
+ Will prefix the keys with ``js.components.foobar``. This system also switches the **interpolation format** from ``%{foo}`` to ``{foo}``, when handling Vue,JS,TS file.
63
+
52
64
 
53
65
  ## Contributing
54
66
 
data/extract_i18n.gemspec CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = ExtractI18n::VERSION
8
8
  spec.authors = ["Stefan Wienert"]
9
9
  spec.email = ["info@stefanwienert.de"]
10
+ spec.metadata = { "rubygems_mfa_required" => "true" }
10
11
 
11
12
  spec.summary = %q{Extact i18n from Ruby files using Ruby parser and slim files using regex}
12
13
  spec.description = %q{Extact i18n from Ruby files using Ruby parser and slim files using regex interactively}
@@ -20,10 +21,12 @@ Gem::Specification.new do |spec|
20
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
22
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = "exe"
25
- spec.executables << "extract-i18n"
24
+ end - ['js/build.js', 'js/package.json', 'js/yarn.lock', 'js/run.mjs']
25
+
26
+ spec.bindir = "exe"
27
+ spec.executables << "extract-i18n"
26
28
  spec.require_paths = ["lib"]
29
+ spec.required_ruby_version = '>= 2.7.0'
27
30
 
28
31
  spec.add_runtime_dependency 'nokogiri'
29
32
  spec.add_runtime_dependency 'parser', '>= 2.6'
data/js/.gitignore ADDED
@@ -0,0 +1 @@
1
+ node_modules
data/js/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ nodejs 18.12.1