Skip to content

A project's locale list silently accrues whoever opens it #1246

Description

@amyjko

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.setLocalesProjects.localizeProject.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    localizationAnything related to natural language.needs designWhen an enhancement is not yet designedprojectsAnything related to project management.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions