internationalize 0.2.2 → 0.2.4

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: a78574c3b203b7ae3dd699ab2c4c429503922d134f40c990e99dea103e241b12
4
- data.tar.gz: 2c0ff80e85f73e66e9e04ad572d4b711150ce8853aab53880b326c65be8a551f
3
+ metadata.gz: bfc56411ee42ac5d8377fe409418e1692acc4cb0c5cd60899acd70003f0d4dd7
4
+ data.tar.gz: 9a437ba5771695b1d84b7d95e61d4df4e342725501df6dc947809245750054a9
5
5
  SHA512:
6
- metadata.gz: bbfe57de55d2e7f0d52b02c34eac3c79fa0a71c353dbccf0f65e1c82053e77f66f83ebe40fa69262a123d81bd4c7f78624bc15de6b5001d9227e7032d697633e
7
- data.tar.gz: d45d9c2a223eb3e740e2da4e17266d4eb0a3590162425f9fb52620224cbe4844dfc987af7394893d42b1a601689f163fff3b05d0531009c296659efd74535162
6
+ metadata.gz: 4354ea3355e467ebfc465feacdb707189b5981f6df04e8620e8b72dbf4c84f4df8e2d454e3a405f0ffd7c923ec4c8c946f119241b99ddf978d700fbeebb1ecbf
7
+ data.tar.gz: 82e139593ed3296be30e601376b147cfaf2690255f25c2be69b7add169568b388ad721bd14a0f6244489987e4bbf9fc4a89f303a8c87a1f94eca99f5e524b8b0
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.4] - 2024-11-29
11
+
12
+ ### Added
13
+
14
+ - Fixtures documentation and tests demonstrating YAML format for translation columns
15
+
16
+ ## [0.2.3] - 2024-11-29
17
+
18
+ ### Added
19
+
20
+ - Auto-load RichText via Rails Railtie (fixes load order issue)
21
+
10
22
  ## [0.2.2] - 2024-11-29
11
23
 
12
24
  ### Added
data/README.md CHANGED
@@ -196,6 +196,19 @@ article.content.body # ActionText::Content object
196
196
  article.content.embeds # Attachments work per-locale
197
197
  ```
198
198
 
199
+ ### Fixtures
200
+
201
+ Use the `*_translations` column name with nested locale keys:
202
+
203
+ ```yaml
204
+ # test/fixtures/articles.yml
205
+ hello_world:
206
+ title_translations:
207
+ en: "Hello World"
208
+ de: "Hallo Welt"
209
+ status: published
210
+ ```
211
+
199
212
  ## Configuration
200
213
 
201
214
  ```ruby
data/context/model-api.md CHANGED
@@ -113,3 +113,36 @@ article.content # Gets for current locale (with fallback)
113
113
  article.content.body # ActionText::Content object
114
114
  article.content.embeds # Attachments work per-locale
115
115
  ```
116
+
117
+ ## Fixtures
118
+
119
+ Use the actual column name (`*_translations`) in fixtures, not the virtual accessor:
120
+
121
+ ### Nested Format
122
+
123
+ ```yaml
124
+ # test/fixtures/articles.yml
125
+ hello_world:
126
+ title_translations:
127
+ en: "Hello World"
128
+ de: "Hallo Welt"
129
+ description_translations:
130
+ en: "A greeting"
131
+ de: "Eine Begrüßung"
132
+ status: published
133
+ ```
134
+
135
+ ### Inline Hash Format
136
+
137
+ ```yaml
138
+ japanese_post:
139
+ title_translations: { en: "Hello", ja: "こんにちは" }
140
+ status: published
141
+ ```
142
+
143
+ ### Important Notes
144
+
145
+ - Use `title_translations:` (column name), NOT `title:`
146
+ - Keys can be symbols (`:en`) or strings (`"en"`) - YAML converts them
147
+ - Both nested and inline hash formats work identically
148
+ - Missing locales are simply not set (no error)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Internationalize
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.4"
5
5
  end
@@ -6,7 +6,6 @@ require "active_record"
6
6
  require_relative "internationalize/version"
7
7
  require_relative "internationalize/adapters"
8
8
  require_relative "internationalize/model"
9
- require_relative "internationalize/rich_text" if defined?(ActionText)
10
9
 
11
10
  module Internationalize
12
11
  class << self
@@ -22,4 +21,12 @@ module Internationalize
22
21
  available_locales || I18n.available_locales
23
22
  end
24
23
  end
24
+
25
+ class Railtie < Rails::Railtie
26
+ initializer "internationalize.action_text" do
27
+ ActiveSupport.on_load(:action_text_rich_text) do
28
+ require "internationalize/rich_text"
29
+ end
30
+ end
31
+ end if defined?(Rails::Railtie)
25
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internationalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampo Kuokkanen