translated 0.7.0 → 0.8.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d39bf3bbcbb292ad9ab54256c1295e49658d40f32fb801f0ce9332121d4a860e
|
|
4
|
+
data.tar.gz: e8e5d9cee7ec307d166f40aff02d8a7ff3e81f52bb88e0e64fe7ef6a901090ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7d098cefe5de5b9009539b5d9c71cdbd8d8c4884336a823c7e57b033a077311ad1de46898eeb68009b0253b6de7079270e2b8203a153ab4ea1d50f08dc9774b
|
|
7
|
+
data.tar.gz: 25c6d9b05735855f2e33aec1530a3b397fc928e3b7164f7da657573f25a01279b2eeb67e8efe5f2a55a52e447d421cbd2f9cf7caeddeb5611674fe99ae5b2cd6
|
|
@@ -8,8 +8,19 @@ module Translated
|
|
|
8
8
|
|
|
9
9
|
validates :language, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
|
10
10
|
|
|
11
|
-
scope :with_missing_translations,
|
|
12
|
-
|
|
11
|
+
scope :with_missing_translations, lambda {
|
|
12
|
+
json_length_expression = case connection.adapter_name
|
|
13
|
+
when /mysql/i
|
|
14
|
+
'JSON_LENGTH(content)'
|
|
15
|
+
when /sqlite/i
|
|
16
|
+
"(SELECT count(*) FROM json_each(#{table_name}.content))"
|
|
17
|
+
when /postgres/i
|
|
18
|
+
'(SELECT count(*) FROM jsonb_each_text(content::jsonb))'
|
|
19
|
+
else
|
|
20
|
+
'JSON_LENGTH(content)'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
where.not(id: where("#{json_length_expression} >= ?", I18n.available_locales.size))
|
|
13
24
|
}
|
|
14
25
|
|
|
15
26
|
after_commit :update_translations_later, if: :needs_translations?
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateTranslatedTranslatedTextFields < ActiveRecord::Migration[7.1]
|
|
2
4
|
def change
|
|
3
5
|
create_table :translated_translated_text_fields do |t|
|
|
4
6
|
t.references :translatable, polymorphic: true, null: false
|
data/lib/translated/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: translated
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trae Robrock
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-03-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activejob
|