Skip to content

Add Brazilian Portuguese translation - #122

Open
silvaivanilto wants to merge 2 commits into
typecraft-dev:mainfrom
silvaivanilto:feat/pt-br-i18n
Open

silvaivanilto wants to merge 2 commits into
typecraft-dev:mainfrom
silvaivanilto:feat/pt-br-i18n

Conversation

@silvaivanilto

@silvaivanilto silvaivanilto commented Nov 30, 2026 •

Copy link
Copy Markdown

What

omacast now follows Omarchy's language live (Commons.Translations), with English and Brazilian Portuguese catalogs.

  • i18n/en.json, i18n/pt-BR.json: UI strings (placeholders, empty states, toasts, footer, alerts, detail pane).
  • core/Localize.js (pure, no Qt): translates the English text core/ already produces (section titles, actions, confirmations, calculator captions, relative times, type labels), so core/ modules stay language-free and unchanged in behaviour.
  • Omarchy menu items use Omarchy's own default/i18n/<lang>/menu.json (OmarchyMenu.applyTranslations). The English label is kept as an alias, so typing "nightlight" still finds "Luz noturna".
  • Dates and the 12/24-hour clock use Commons.I18n.formatLocale instead of Qt.locale().
  • Switching language rebuilds candidates and retitles pushed views without reopening.
  • calculatorRevision is a double (it sums Date.now() values, which overflow int).

With the language set to English nothing changes visually.

Testing

  • node --test tests/*.test.js: 194 pass (new tests/i18n.test.js checks catalog parity, placeholders and the Localize mappings).
  • omarchy plugin validate . passes.
  • tests/smoke.sh on Omarchy with pt-BR: all checks pass (the nightlight check accepts the translated label). The toggle-latency check is over budget on my machine both before and after this change.

🤖 Generated with Claude Code

Confidence Score: 5/5 · The PR appears safe to merge with four non-blocking display and search issues still open.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge with four non-blocking display and search issues still open.

FindingsFix All in Claude CodeFindings

  1. P2 Messages change inserted text ▶
  2. P2 Clipboard titles change copied text ▶
  3. P2 Panels keep the old language ▶
  4. P2 Displayed answers cannot be found ▶
Fix with agent prompt
### Issue 1
core/Localize.js:8-9
`Localize.format` replaces placeholders inside values it has already inserted. For example, an alias of `%2` in `error.aliasUsed` becomes the other command's title instead of appearing literally. Replace placeholders in one pass over the original template so argument text stays unchanged.

### Issue 2
core/Localize.js:236-238
`Localize.candidate` treats every clipboard title matching `N Files` as a generated file count. Plain copied text such as `3 Files`, or a single file named `3 Files`, gets renamed to `3 arquivos` in Brazilian Portuguese. This makes the list misleading even though pasting returns the original content. Pass the file count separately and translate only generated labels.

### Issue 3
ui/LauncherWindow.qml:910-912
A language change does not refresh an open action panel, About panel, or confirmation message. Their text is saved when they open, while nearby labels update immediately. The candidate-change handler also skips the list refresh when an action panel or alert is open, and closing it does not retry that refresh. Users can keep seeing the old language until another refresh. Update the saved panel text and retry any skipped list refresh when the language changes.

### Issue 4
core/Localize.js:240-241
Calculator History now shows translated answers, but `Calculator.filterHistory` still searches the stored English answer before translation. In Brazilian Portuguese, an answer shown as `1,5 horas` cannot be found by typing `horas` or `1,5` unless the original query contains that text. Search the translated answer as well as the original query and answer.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Brazilian Portuguese support and follows Omarchy’s selected language.

  • omacast’s interface and search results follow Omarchy’s active language.
  • Omarchy menu labels follow the active language and keep English search names.

Reviews (3) · Last reviewed commit: "pt-BR: localized calculator numbers, low..." · Reviewed by Greptile

omacast now follows Omarchy's language live. Strings live in i18n/en.json
and i18n/pt-BR.json and load through Commons.Translations; core/Localize.js
translates the English text core/ produces (sections, actions, toasts,
confirmations, calculator captions and relative times), so core/ stays
language-free. Omarchy menu labels come from Omarchy's own
default/i18n/<lang>/menu.json, keeping the English label as an alias so
English searches still match. Dates and the 12/24-hour clock use
Commons.I18n.formatLocale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread core/Localize.js
Comment on lines +8 to +9
for (var i = 0; i < args.length; i++) {
out = out.split("%" + (i + 1)).join(String(args[i]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Messages change inserted text

Localize.format replaces placeholders inside values it has already inserted. For example, an alias of %2 in error.aliasUsed becomes the other command's title instead of appearing literally. Replace placeholders in one pass over the original template so argument text stays unchanged.

Prompt To Fix With AI
This is a comment left during a code review.
Path: core/Localize.js
Line: 8-9

Comment:
**Messages change inserted text**

`Localize.format` replaces placeholders inside values it has already inserted. For example, an alias of `%2` in `error.aliasUsed` becomes the other command's title instead of appearing literally. Replace placeholders in one pass over the original template so argument text stays unchanged.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Comment thread core/Localize.js
Comment on lines +206 to +208
if (out.kind === "clipboard") {
var filesMatch = String(out.title || "").match(/^(\d+) Files$/)
if (filesMatch) out.title = format(tn("clipboard.filesCount", Number(filesMatch[1]), "%1 Files"), [filesMatch[1]])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Clipboard titles change copied text

Localize.candidate treats every clipboard title matching N Files as a generated file count. Plain copied text such as 3 Files, or a single file named 3 Files, gets renamed to 3 arquivos in Brazilian Portuguese. This makes the list misleading even though pasting returns the original content. Pass the file count separately and translate only generated labels.

Prompt To Fix With AI
This is a comment left during a code review.
Path: core/Localize.js
Line: 206-208

Comment:
**Clipboard titles change copied text**

`Localize.candidate` treats every clipboard title matching `N Files` as a generated file count. Plain copied text such as `3 Files`, or a single file named `3 Files`, gets renamed to `3 arquivos` in Brazilian Portuguese. This makes the list misleading even though pasting returns the original content. Pass the file count separately and translate only generated labels.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Comment thread ui/LauncherWindow.qml
Comment on lines +910 to +912
function onCandidatesRevisionChanged() {
window.refreshStackTitles()
if (window.shown && !window.actionPanelOpen && !window.alert) window.rebuild(false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Panels keep the old language

A language change does not refresh an open action panel, About panel, or confirmation message. Their text is saved when they open, while nearby labels update immediately. The candidate-change handler also skips the list refresh when an action panel or alert is open, and closing it does not retry that refresh. Users can keep seeing the old language until another refresh. Update the saved panel text and retry any skipped list refresh when the language changes.

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/LauncherWindow.qml
Line: 910-912

Comment:
**Panels keep the old language**

A language change does not refresh an open action panel, About panel, or confirmation message. Their text is saved when they open, while nearby labels update immediately. The candidate-change handler also skips the list refresh when an action panel or alert is open, and closing it does not retry that refresh. Users can keep seeing the old language until another refresh. Update the saved panel text and retry any skipped list refresh when the language changes.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

…alias

- Calculator results (root, history and the About panel) use the catalog's
  decimal and group separators (2.469.135,782; 152,4 cm) and translate the
  long unit names Calculator.js spells out (1,5 horas, 5 dias úteis).
  English output is unchanged. Clipboard sizes follow the same separators.
- Month names are lowercase in pt-BR dates, as Portuguese writes them.
- Alias is "apelido", so it no longer reads like a keyboard shortcut
  ("atalho"); "Copiar ID do .desktop" replaces "Copiar ID Desktop".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread core/Localize.js
Comment on lines +240 to +241
if (out.kind === "calculator-history") {
out.title = out.calcKind === "date" ? calcDate(out.title, t) : calcResult(out.title, out.calcKind, t)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Displayed answers cannot be found

Calculator History now shows translated answers, but Calculator.filterHistory still searches the stored English answer before translation. In Brazilian Portuguese, an answer shown as 1,5 horas cannot be found by typing horas or 1,5 unless the original query contains that text. Search the translated answer as well as the original query and answer.

Prompt To Fix With AI
This is a comment left during a code review.
Path: core/Localize.js
Line: 240-241

Comment:
**Displayed answers cannot be found**

Calculator History now shows translated answers, but `Calculator.filterHistory` still searches the stored English answer before translation. In Brazilian Portuguese, an answer shown as `1,5 horas` cannot be found by typing `horas` or `1,5` unless the original query contains that text. Search the translated answer as well as the original query and answer.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant