internationalize 0.6.0 → 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 +4 -4
- data/lib/internationalize/rich_text.rb +5 -2
- data/lib/internationalize/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 989275d4cd10812f99f919f7c52ed1c91d6a55c17cc4db7a521c94903389dac7
|
|
4
|
+
data.tar.gz: 0170b99a0a5a8e07fdde7205d0a9643ef1433d0b357669f504da0beffc0d3a0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8034cf07c1acb30f5f73e396da40fa5ac12ce793c76d087e516dc4ac5227ab93c148129428724439d56978c363414089ef5ad497fe449898fa7d88188fffb6a3
|
|
7
|
+
data.tar.gz: 7c04d4651dfa21805efe5b08fe2c8eaa24d76029bcd507b3f6a3d7cf627e23fd676d27e4980ef45e24b64ebcba415ac527edf012c0dc25a528a1221a75eb42f4
|
|
@@ -45,7 +45,8 @@ module Internationalize
|
|
|
45
45
|
|
|
46
46
|
# Main getter - returns rich text for current locale with fallback to default locale
|
|
47
47
|
define_method(name) do
|
|
48
|
-
|
|
48
|
+
# Normalize hyphenated locales (e.g., "zh-TW" -> "zh_TW") for method dispatch
|
|
49
|
+
locale_str = I18n.locale.to_s.tr("-", "_")
|
|
49
50
|
rich_text = send(:"#{name}_#{locale_str}")
|
|
50
51
|
|
|
51
52
|
if rich_text.blank? && locale_str != default_locale_str
|
|
@@ -57,7 +58,9 @@ module Internationalize
|
|
|
57
58
|
|
|
58
59
|
# Main setter - sets rich text for current locale
|
|
59
60
|
define_method(:"#{name}=") do |value|
|
|
60
|
-
|
|
61
|
+
# Normalize hyphenated locales (e.g., "zh-TW" -> "zh_TW") for method dispatch
|
|
62
|
+
locale_str = I18n.locale.to_s.tr("-", "_")
|
|
63
|
+
send(:"#{name}_#{locale_str}=", value)
|
|
61
64
|
end
|
|
62
65
|
|
|
63
66
|
# Predicate method
|