locallingo 0.4.0 → 0.4.1
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/CHANGELOG.md +7 -0
- data/lib/locallingo/manager.rb +11 -6
- data/lib/locallingo/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: 566c302b3598359e622f4b6b98a59bf1a8b3487fc81b898ca93a2d0446c31c63
|
|
4
|
+
data.tar.gz: 9961bb74a9f23e2bebdaa4c64913723a195eaac89470a68e3f175b87f2a68e24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 441a84936ce9cb8cba5354bfc81ec49de1d498190b81c9020c52df3b4d7fa4ef15aefde5b6d9911e5dabf161227765f93aa75c6e99e677f61febb0dbfbd95a3e
|
|
7
|
+
data.tar.gz: 4d18fed67d04efb9750abb753fee743bd4a206bc9c396e95c882db5d2add9c948782cc65f38bb4b64f9f51018281d7c8af4b4130a37c8b36ddae420cd688f4db
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
9
|
### Fixed
|
|
10
|
+
- `lingo sync` backfills a missing `target_hash` from the current target value,
|
|
11
|
+
so hand-added translations (written straight into the YAML, never passing
|
|
12
|
+
through `translate` or `accept-edits`) get a baseline and the `manual_edits`
|
|
13
|
+
validator can watch them. An existing `target_hash` is still never
|
|
14
|
+
recomputed — that would silently absorb hand-edit drift.
|
|
15
|
+
|
|
16
|
+
### Fixed (0.4.0)
|
|
10
17
|
- `lingo sync` no longer destroys hand-edit protection: it now only refreshes
|
|
11
18
|
each entry's `source_hash` and preserves `target_hash` and `manual: true`
|
|
12
19
|
(the pre-extraction `bin/translate` behavior). Previously a single sync wiped
|
data/lib/locallingo/manager.rb
CHANGED
|
@@ -134,11 +134,12 @@ module Locallingo
|
|
|
134
134
|
format("%08x", Zlib.crc32(load_source_translations.to_json))
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
# Refresh source hashes from the current translation files
|
|
138
|
-
# for
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
#
|
|
137
|
+
# Refresh source hashes from the current translation files, backfill a
|
|
138
|
+
# `target_hash` baseline for entries that lack one, and prune state for
|
|
139
|
+
# keys that no longer exist. An existing `target_hash` and the `manual`
|
|
140
|
+
# flag are never touched — hand-edit protection is never dropped by a
|
|
141
|
+
# sync; use `accept_edits!` to resolve hand-edit drift explicitly.
|
|
142
|
+
# Returns the combined state.
|
|
142
143
|
def sync_state!
|
|
143
144
|
source = load_source_translations
|
|
144
145
|
|
|
@@ -171,12 +172,16 @@ module Locallingo
|
|
|
171
172
|
target = load_locale_translations(locale)
|
|
172
173
|
locale_state = @state.load(locale)
|
|
173
174
|
|
|
174
|
-
target.
|
|
175
|
+
target.each do |key, value|
|
|
175
176
|
next unless source[key]
|
|
176
177
|
|
|
177
178
|
existing = locale_state[key]
|
|
178
179
|
entry = existing.is_a?(Hash) ? existing.dup : {}
|
|
179
180
|
entry["source_hash"] = @state.hash(source[key])
|
|
181
|
+
# Backfill a baseline for hand-added translations so the manual-edits
|
|
182
|
+
# validator can watch them; an existing target_hash is never recomputed —
|
|
183
|
+
# that would silently absorb hand-edit drift.
|
|
184
|
+
entry["target_hash"] ||= @state.hash(value)
|
|
180
185
|
locale_state[key] = entry
|
|
181
186
|
end
|
|
182
187
|
locale_state.each_key { |key| locale_state.delete(key) unless target.key?(key) }
|
data/lib/locallingo/version.rb
CHANGED