awesome_translations 0.0.63 → 0.0.65
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/awesome_translations/clean_ups_controller.rb +1 -1
- data/app/controllers/awesome_translations/movals_controller.rb +1 -1
- data/lib/awesome_translations/erb_inspector/file_inspector.rb +13 -5
- data/lib/awesome_translations/handlers/devise_handler.rb +1 -1
- data/lib/awesome_translations/handlers/rails_handler.rb +1 -1
- data/lib/awesome_translations/handlers/will_paginate_handler.rb +1 -1
- data/lib/awesome_translations/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a064cb6ccd392d08ccc04527a80a5b5926d7e49597f05560a6a0168d1498d1d
|
4
|
+
data.tar.gz: 151f20aed7e4142f9446894ce8d5f11ad02e20e3d51df242d7a4b264dc1102cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16dbaadb429667549c1ab80bd40fe24086ef8bfb47018b4e248dd2e401e4de97a217ebe26a58dfaf4ed29f614b9403516ab79e075140a8b5c8e8b80be2d96db3
|
7
|
+
data.tar.gz: 7c70d4067de4bad81339467c0e5f270a9146f02fd4b9947f5b07c812f2682b1933f1e768fe8c8707909cd1bcf7fedceb5646e3f072fac43df3ab7e59673f9656
|
@@ -22,7 +22,7 @@ private
|
|
22
22
|
|
23
23
|
helper_method :translations_to_clean_up
|
24
24
|
def translations_to_clean_up
|
25
|
-
@
|
25
|
+
@translations_to_clean_up ||= AwesomeTranslations::CacheDatabaseGenerator::TranslationValue
|
26
26
|
.joins(:translation_key)
|
27
27
|
.includes(:translation_key)
|
28
28
|
.joins("LEFT JOIN handler_translations ON handler_translations.translation_key_id = translation_keys.id")
|
@@ -11,7 +11,7 @@ class AwesomeTranslations::MovalsController < AwesomeTranslations::ApplicationCo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def create
|
14
|
-
params[:m].
|
14
|
+
params[:m].each_key do |translation_value_id|
|
15
15
|
translation_value = AwesomeTranslations::CacheDatabaseGenerator::TranslationValue.find(translation_value_id)
|
16
16
|
translation_value.migrate_to_awesome_translations_namespace!
|
17
17
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class AwesomeTranslations::ErbInspector::FileInspector
|
2
|
-
JS_FILE_EXTS = [".coffee", ".coffee.erb", ".es6", ".es6.erb", ".js", ".js.erb", ".jsx"].freeze
|
2
|
+
JS_FILE_EXTS = [".cjs", ".coffee", ".coffee.erb", ".es6", ".es6.erb", ".js", ".js.erb", ".jsx", ".mjs"].freeze
|
3
3
|
METHOD_NAMES = %w[t controller_t helper_t].freeze
|
4
4
|
VALID_BEGINNING = '(^|\s+|\(|\{|\[|<%=\s*|I18n\.)'.freeze
|
5
|
+
VALID_BEGINNING_JS = '(^|\s+|\(|\[|\.)'.freeze
|
5
6
|
|
6
7
|
attr_reader :root_path, :file_path
|
7
8
|
|
@@ -18,6 +19,7 @@ class AwesomeTranslations::ErbInspector::FileInspector
|
|
18
19
|
extname = File.extname(full_path)
|
19
20
|
translations_found = []
|
20
21
|
line_no = 0
|
22
|
+
@namespace = nil
|
21
23
|
|
22
24
|
fp.each_line do |line|
|
23
25
|
line_no += 1
|
@@ -68,12 +70,16 @@ private
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def parse_content_js(line_no, line, translations_found, yielder)
|
71
|
-
line.scan(/
|
72
|
-
|
73
|
+
line.scan(/useI18n\(\s*\{\s*namespace:\s*"(.+)"/) do |match|
|
74
|
+
@namespace = match[0]
|
73
75
|
end
|
74
76
|
|
75
|
-
line.scan(
|
76
|
-
add_translation(line_no, "I18n-js.t", match[
|
77
|
+
line.scan(/#{VALID_BEGINNING_JS}t\('(.+?)'\s*(\)|,)/o) do |match|
|
78
|
+
add_translation(line_no, "I18n-js.t", match[1], translations_found, yielder)
|
79
|
+
end
|
80
|
+
|
81
|
+
line.scan(/#{VALID_BEGINNING_JS}t\("(.+?)"\s*(\)|,)/o) do |match|
|
82
|
+
add_translation(line_no, "I18n-js.t", match[1], translations_found, yielder)
|
77
83
|
end
|
78
84
|
end
|
79
85
|
|
@@ -103,6 +109,8 @@ private
|
|
103
109
|
end
|
104
110
|
|
105
111
|
def add_translation(line_no, method, key, translations_found, yielder)
|
112
|
+
key = "#{@namespace}#{key}" if key.start_with?(".") && @namespace
|
113
|
+
|
106
114
|
translation_inspector = AwesomeTranslations::ErbInspector::TranslationInspector.new(
|
107
115
|
last_method: @last_method,
|
108
116
|
root_path: @root_path,
|
@@ -22,7 +22,7 @@ class AwesomeTranslations::Handlers::DeviseHandler < AwesomeTranslations::Handle
|
|
22
22
|
def translations_for_group(group)
|
23
23
|
ArrayEnumerator.new do |yielder|
|
24
24
|
dir = Rails.root.join("config", "locales", "awesome_translations", group.id).to_s
|
25
|
-
__send__("translations_for_#{group.id}", dir, group, yielder)
|
25
|
+
__send__(:"translations_for_#{group.id}", dir, group, yielder)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -18,7 +18,7 @@ class AwesomeTranslations::Handlers::RailsHandler < AwesomeTranslations::Handler
|
|
18
18
|
def translations_for_group(group)
|
19
19
|
ArrayEnumerator.new do |yielder|
|
20
20
|
dir = Rails.root.join("config", "locales", "awesome_translations", group.id).to_s
|
21
|
-
__send__("translations_for_#{group.id}", dir, group, yielder)
|
21
|
+
__send__(:"translations_for_#{group.id}", dir, group, yielder)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -22,7 +22,7 @@ class AwesomeTranslations::Handlers::WillPaginateHandler < AwesomeTranslations::
|
|
22
22
|
def translations_for_group(group)
|
23
23
|
ArrayEnumerator.new do |yielder|
|
24
24
|
dir = Rails.root.join("config", "locales", "awesome_translations", group.id).to_s
|
25
|
-
__send__("translations_for_#{group.id}", dir, group, yielder)
|
25
|
+
__send__(:"translations_for_#{group.id}", dir, group, yielder)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_translations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.65
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Kasper
|
8
|
-
autorequire:
|
7
|
+
- Kasper Stöckel
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active-record-transactioner
|
@@ -124,7 +124,7 @@ dependencies:
|
|
124
124
|
version: 0.0.3
|
125
125
|
description: Semi-automatic maintenance of most translations in a Rails app.
|
126
126
|
email:
|
127
|
-
-
|
127
|
+
- k@spernj.org
|
128
128
|
executables: []
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
@@ -204,7 +204,7 @@ homepage: https://www.github.com/kaspernj/awesome_translations
|
|
204
204
|
licenses: []
|
205
205
|
metadata:
|
206
206
|
rubygems_mfa_required: 'true'
|
207
|
-
post_install_message:
|
207
|
+
post_install_message:
|
208
208
|
rdoc_options: []
|
209
209
|
require_paths:
|
210
210
|
- lib
|
@@ -219,8 +219,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
223
|
-
signing_key:
|
222
|
+
rubygems_version: 3.4.10
|
223
|
+
signing_key:
|
224
224
|
specification_version: 4
|
225
225
|
summary: Semi-automatic maintenance of most translations in a Rails app.
|
226
226
|
test_files: []
|