fix(m85): localize the market recruit detail line and gate its language purity

This commit is contained in:
2026-09-18 09:09:36 +08:00
parent d4bd0d012e
commit 13eb8a4044
2 changed files with 31 additions and 4 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ func short_context_detail(kind: String, offer: Dictionary, company: Dictionary,
match kind:
"recruit":
var owned_count := Array(company.get("owned_recruits", [])).size()
return _tr("%s · %s\n%d Coin · Company %d → %d", "%s · %s\n%d COIN · Company %d -> %d", locale) % [
return _tr("%s · %s\n%d 金币 · 队伍 %d → %d", "%s · %s\n%d COIN · Company %d -> %d", locale) % [
content_name(content, "professions", String(offer.get("profession_id", "")), locale),
content_name(content, "traits", String(offer.get("trait_id", "")), locale),
int(offer.get("list_price", 0)),
+30 -3
View File
@@ -5,6 +5,7 @@ extends SceneTree
const MarketPageView = preload("res://entry/views/market_page_view.gd")
const InkCheck = preload("res://tools/ui_ink_check.gd")
const MarketController = preload("res://entry/market_page_controller.gd")
const MarketChrome = preload("res://ui/shared/market_chrome.gd")
# Single authoritative size (owner policy): every page is authored at 1280x720.
const FIXTURES := [
@@ -84,6 +85,13 @@ func _run() -> void:
quit(1)
return
print("ABG_M59_INK_CHECK_OK scanned=%d violations=0" % ink_scanned)
if not _copy_purity_failures().is_empty():
for failure in _copy_purity_failures():
push_error("M85 market copy: %s" % failure)
print("ABG_M85_MARKET_COPY_FAIL failures=%d" % _copy_purity_failures().size())
quit(1)
return
print("ABG_M85_MARKET_COPY_OK zh=no_latin en=unchanged scope=short_context_detail")
print("ABG_M82_MARKET_STATE_MATRIX_OK empty=clean available=ok hired=ok title_ink=inside targets=48 viewports=reference:1280x720,minimum:1280x600,wide:1600x720 gates=reference+minimum")
print("ABG_M52_MARKET_VISUAL_PROBE_OK viewports=3 gated=2 locale_count=2 states=empty,available,hired scales=1.0,1.3 scans=%d views=static,dynamic,final" % ink_scanned)
quit(0)
@@ -837,9 +845,9 @@ func _recruit(offer_id: String, recruit_name: String, locale: String, longest :=
# controller ("profession · trait" then price and Company growth). Keep the
# fixture in that authored shape so the ledger slot is exercised honestly.
var zh_details := [
"%s · %s\n%d Coin · %s" % [zh_professions[slot], zh_traits[slot], list_prices[slot], company_line],
"%s · %s\n%d Coin · %s" % [zh_professions[1], zh_traits[1], list_prices[1], company_line],
"%s · %s\n%d Coin · %s" % [zh_professions[2], zh_traits[2], list_prices[2], company_line],
"%s · %s\n%d 金币 · 队伍 %s" % [zh_professions[slot], zh_traits[slot], list_prices[slot], company_line],
"%s · %s\n%d 金币 · 队伍 %s" % [zh_professions[1], zh_traits[1], list_prices[1], company_line],
"%s · %s\n%d 金币 · 队伍 %s" % [zh_professions[2], zh_traits[2], list_prices[2], company_line],
]
var en_details := [
"%s · %s\n%d COIN · %s" % [en_professions[slot], en_traits[slot], list_prices[slot], company_line_en],
@@ -860,3 +868,22 @@ func _recruit(offer_id: String, recruit_name: String, locale: String, longest :=
"short_detail": zh_details[slot] if is_zh else en_details[slot],
},
}
func _copy_purity_failures() -> Array:
# The assertion runs on the production helper, not on a hand-written fixture.
var failures: Array = []
var controller = MarketController.new()
var offer := {"profession_id": "PF-B01", "trait_id": "TR-001", "list_price": 999}
var company := {"owned_recruits": [1, 2, 3, 4, 5, 6, 7, 8]}
var zh := String(controller.short_context_detail("recruit", offer, company, "zh_CN", {}))
var en := String(controller.short_context_detail("recruit", offer, company, "en", {}))
var latin := RegEx.new()
latin.compile("[A-Za-z]")
if latin.search(zh) != null:
failures.append("zh line still carries latin letters: %s" % zh)
if not zh.contains("金币") or not zh.contains("队伍"):
failures.append("zh line lost its localized nouns: %s" % zh)
if not (en.contains("COIN") or en.contains("Coin")) or not en.contains("Company"):
failures.append("en line shape changed: %s" % en)
return failures