Repository navigation
Add Brazilian Portuguese translation - #122
silvaivanilto wants to merge 2 commits into
Conversation
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>
| for (var i = 0; i < args.length; i++) { | ||
| out = out.split("%" + (i + 1)).join(String(args[i])) |
There was a problem hiding this comment.
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.| 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]]) |
There was a problem hiding this 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.
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.| function onCandidatesRevisionChanged() { | ||
| window.refreshStackTitles() | ||
| if (window.shown && !window.actionPanelOpen && !window.alert) window.rebuild(false) |
There was a problem hiding this comment.
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.…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>
| if (out.kind === "calculator-history") { | ||
| out.title = out.calcKind === "date" ? calcDate(out.title, t) : calcResult(out.title, out.calcKind, t) |
There was a problem hiding this 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.
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.
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 textcore/already produces (section titles, actions, confirmations, calculator captions, relative times, type labels), socore/modules stay language-free and unchanged in behaviour.default/i18n/<lang>/menu.json(OmarchyMenu.applyTranslations). The English label is kept as an alias, so typing "nightlight" still finds "Luz noturna".Commons.I18n.formatLocaleinstead ofQt.locale().calculatorRevisionis adouble(it sumsDate.now()values, which overflowint).With the language set to English nothing changes visually.
Testing
node --test tests/*.test.js: 194 pass (newtests/i18n.test.jschecks catalog parity, placeholders and the Localize mappings).omarchy plugin validate .passes.tests/smoke.shon 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.Fix with agent prompt
Summary
Adds Brazilian Portuguese support and follows Omarchy’s selected language.
Reviews (3) · Last reviewed commit: "pt-BR: localized calculator numbers, low..." · Reviewed by Greptile