Project.deserialize unions the project's declared locales with the viewer's currently selected UI locales (Project.ts#L1229-L1236), and serialize() writes that merged list back (Project.ts#L1466):
const dependentLocales = await localesDB.loadLocales(
getBestSupportedLocales(project.locales),
);
const locales = Array.from(
new Set([...dependentLocales, ...localesDB.getLocales()]),
);
LocalesDatabase.setLocales → Projects.localize → Project.withLocales additionally prepends newly chosen locales to every tracked project, so switching UI language once rewrites the locale list of every open project. Nothing ever removes a locale, so a project only gains them, and its Basis — hence the names bound in scope — depends on who last opened it.
This is how #1228 reproduced on a personal copy but not the gallery copy of the same program: examples recompute locales from their === name/lang source headers (examples.ts#L86) and stayed single-locale, while the persisted personal copy had accrued hi-IN.
Two smaller things in the same area:
- A locale whose fetch fails at load time is silently dropped from the in-memory list, and the next save then drops it from the stored project.
Project.getLocalesUsed() — the set actually derived from the code — never feeds the persisted locales field.
Not a correctness bug on its own (multi-locale projects have to work regardless, which is what #1228 fixed), but the accrual makes a project's analysis depend on its viewer, which is surprising and made that bug hard to reproduce.
Project.deserializeunions the project's declared locales with the viewer's currently selected UI locales (Project.ts#L1229-L1236), andserialize()writes that merged list back (Project.ts#L1466):LocalesDatabase.setLocales→Projects.localize→Project.withLocalesadditionally prepends newly chosen locales to every tracked project, so switching UI language once rewrites the locale list of every open project. Nothing ever removes a locale, so a project only gains them, and itsBasis— hence the names bound in scope — depends on who last opened it.This is how #1228 reproduced on a personal copy but not the gallery copy of the same program: examples recompute
localesfrom their=== name/langsource headers (examples.ts#L86) and stayed single-locale, while the persisted personal copy had accruedhi-IN.Two smaller things in the same area:
Project.getLocalesUsed()— the set actually derived from the code — never feeds the persistedlocalesfield.Not a correctness bug on its own (multi-locale projects have to work regardless, which is what #1228 fixed), but the accrual makes a project's analysis depend on its viewer, which is surprising and made that bug hard to reproduce.