mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
fix(hud): ask again in the new language after an in-place switch
- _relocalize() now drops the received reply and aborts one in flight, so the next tick asks in the new language instead of keeping old-language text under the new-language state tag. - The English-echo check also allows state words inside a place label (Estación Loading Dock). - Reword the non-English instruction so it reads for every language name. - Add the two new test files to the format scope.
This commit is contained in:
1 parent
1a6687632d
commit
0d3c1ef1d9
5 files changed
+64
-8
No files matched your search
+12
-5
@@ -132,7 +132,8 @@ function withProvenance(text, provenance) {
|
||||
/**
|
||||
* The English a summary outside English must not carry: feed-state ids and
|
||||
* translated layers' English names. A state word the locale keeps in English
|
||||
* (de FALLBACK) and a layer name inside a place label (Radio City) are fine.
|
||||
* (de FALLBACK) and words inside a place label (Radio City, Loading Dock) are
|
||||
* fine.
|
||||
*/
|
||||
function summaryEnglishWords(context) {
|
||||
const places = [
|
||||
@@ -144,7 +145,9 @@ function summaryEnglishWords(context) {
|
||||
.toLowerCase();
|
||||
return [
|
||||
...Object.keys(FEED_STATE_LABELS).filter(
|
||||
(state) => t(FEED_STATE_LABELS[state]).toLowerCase() !== state,
|
||||
(state) =>
|
||||
t(FEED_STATE_LABELS[state]).toLowerCase() !== state &&
|
||||
!places.includes(state),
|
||||
),
|
||||
...(context.translatedLayerNames || []).filter(
|
||||
(name) => !places.includes(name.toLowerCase()),
|
||||
@@ -323,11 +326,15 @@ export class IntelHUD {
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the HUD's own words in the new locale. The deterministic summary
|
||||
* is composed again; the AI reply does not depend on the locale, so the
|
||||
* next tick shows the one already received rather than asking again.
|
||||
* Show the HUD's own words in the new locale. The AI reply is written in
|
||||
* the locale too, so the one received is dropped like a camera move drops
|
||||
* it: a request in flight is aborted and the next tick asks again.
|
||||
*/
|
||||
_relocalize() {
|
||||
this._markSummaryDirty();
|
||||
this._lastSummarySignature = null;
|
||||
this._lastSummaryText = null;
|
||||
this._summaryRequest?.abort();
|
||||
this._present({
|
||||
mode: MODE_LABELS[this._currentStyle]
|
||||
? t(MODE_LABELS[this._currentStyle])
|
||||
|
||||
Reference in new issue
Block a user