Skip to content

[Bug]: pt-BR is missing from the main-process locale map, so its translations never render #354

Description

@EtienneLescot

Summary

electron/i18n.ts knows about 12 locales; the repo ships 13. pt-BR is missing from the main-process locale map, so every Brazilian-Portuguese translation that main-process code renders falls back to English — even though the translated strings are sitting right there in the repo.

npm run i18n:check cannot catch this: it validates that the 13 locale files agree with en, which they do. The gap is in the main process's own import map.

Detail

electron/i18n.ts:29-56 defines the Locale union and the messages map. There is no commonPtBr import and no pt-BR entry.

Everything rendered by mainT() is affected — native dialogs, the tray context menu, and anything else the main process draws. A pt-BR user gets English for all of it.

Reproduction

  1. Set the app language to Português (Brasil).
  2. Trigger any main-process string — e.g. the tray context menu, or a native dialog.
  3. It renders in English, while src/i18n/locales/pt-BR/common.json contains the correct translation.

Suggested fix

Four one-line additions in electron/i18n.ts:

  • the commonPtBr (and any sibling namespace) import
  • "pt-BR" in the Locale union
  • the messages map entry
  • the setMainLocale guard

Worth adding a check that the main-process locale list and src/i18n/locales/ cannot drift again — a test asserting Object.keys(messages) matches the locale directory listing would fail loudly the next time a locale is added to one and not the other, which is exactly how this happened.

Context

Found while reviewing #313, which adds 5 new common.json keys across all 13 locales. Its pt-BR strings are correct and complete — and unreachable. Pre-existing, so filing separately rather than expanding that PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions