extract_i18n 0.6.2 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a073e9f6b13d0ca1010d71892c5c5d990b769cee22481f02ae1d79e170869c99
4
- data.tar.gz: 88056408f7af54d8e896665d99ca0b64737075d8452d1c4e244111b3d9043dc7
3
+ metadata.gz: b07a5d16f12025d3ec37464e566fcfaaa28869abce178cc2f3db62010951f0b3
4
+ data.tar.gz: 8a65883b89111f03030b589e08f04d12a4c23ee37a7a9009089d7e63b998f712
5
5
  SHA512:
6
- metadata.gz: bf5c0ac83c7b392f7813469a9023f8f9ee03308e35326f94cbf95a3c7f1ab628b62a4aaaf8aa004f34f4e1a4b184fa003116fafaa666c337055e33dca229fae3
7
- data.tar.gz: 508b44e381c020159a03260b2d09421573c8a87a515dbbce5878a382fff3947d1982d8617773c52f41593dd7b2f1df1002784ca74909585165714dae65e1aad9
6
+ metadata.gz: 930d23f1f06983629af272f6e28e70414b3e7b9038450ffb8cb58c0009e004e348abd28d48824f8c5c9a815607f1dc11e546656f3c3d23276c3fafd94d5bcbc9
7
+ data.tar.gz: e018ee20e8e1e676ef425e9e7ec6d8104f5461c38af015e91790293f1ebea3f9747e4f65894af5e0a2a56f374689ee43eb5de3aeea0c43b26d4f4e295d941bee
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