feat(i18n): add pt-BR Portuguese (Brazil) locale support#173
feat(i18n): add pt-BR Portuguese (Brazil) locale support#173itxtoledo wants to merge 6 commits intowebadderall:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Warning
|
| Cohort / File(s) | Summary |
|---|---|
i18n Configuration src/i18n/config.ts |
Added 'pt-BR' to SUPPORTED_LOCALES, expanding the AppLocale union. |
i18n Context Setup src/contexts/I18nContext.tsx |
Imported pt-BR JSON bundles for all namespaces and added a 'pt-BR' entry to the messages mapping used by the translation lookup. |
Portuguese Translation Files src/i18n/locales/pt-BR/common.json, src/i18n/locales/pt-BR/dialogs.json, src/i18n/locales/pt-BR/editor.json, src/i18n/locales/pt-BR/launch.json, src/i18n/locales/pt-BR/settings.json, src/i18n/locales/pt-BR/shortcuts.json, src/i18n/locales/pt-BR/timeline.json |
Added seven new pt-BR locale JSON files containing translated strings for UI labels, actions, dialogs, editor/recording flows, settings, shortcuts, and timeline messages (no runtime logic changes). |
Launch Window UI src/components/launch/LaunchWindow.tsx |
Constrained LOCALE_LABELS typing to Record<AppLocale, string> and added "pt-BR": "Português (Brasil)"; minor formatting adjustments in an update-title call. |
Estimated Code Review Effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
- Add custom cursor packs and harden native postinstall build flow #111 — Adds new cursor style label translations that align with the settings.effects.cursorStyleOptions keys also present in this pt-BR localization.
Poem
🐰 I nibble keys and hop with cheer,
pt‑BR carrots tucked so near,
Seven strings in tidy rows,
Locale blossoms — off it goes!
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. | |
| Description check | ❓ Inconclusive | The description includes the template structure but lacks critical details: no motivation explaining why pt-BR support was needed, no testing guide, no related issue links, and incomplete checklist items. | Complete the template by adding motivation, detailed testing steps (e.g., how to verify the pt-BR locale loads and displays correctly), link any related issues, and complete the checklist items to clarify self-review and changelog status. |
✅ Passed checks (1 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately describes the main change: adding Portuguese (Brazil) locale support to the i18n system, which is the primary objective. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
8c394c0 to
14dd72a
Compare
There was a problem hiding this comment.
Actionable comments posted: 11
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/contexts/I18nContext.tsx`:
- Around line 78-86: Locale normalization fails to handle underscore forms like
"pt_BR", so update the normalizeLocale function to also accept underscores by
converting any "_" to "-" before applying existing normalization rules; ensure
normalizeLocale normalizes inputs such as "pt_BR" to "pt-BR" (and similarly for
other locales) so the language map that includes 'pt-BR' (references:
normalizeLocale, locale lookup and the 'pt-BR' entry) will match on first load.
In `@src/i18n/config.ts`:
- Line 3: LOCALE_LABELS is missing a friendly label for the supported locale
"pt-BR", causing the dropdown to show the raw code; update the LOCALE_LABELS
object (used in LaunchWindow.tsx) to include a "pt-BR" entry with the
appropriate display string (e.g., "Português (Brasil)"). While editing, tighten
the type of LOCALE_LABELS from Record<string,string> to Record<AppLocale,string>
so the compiler will enforce alignment with SUPPORTED_LOCALES and prevent future
drift (ensure AppLocale includes 'pt-BR' if it's defined from
SUPPORTED_LOCALES).
In `@src/i18n/locales/pt-BR/common.json`:
- Around line 5-7: The Portuguese (pt-BR) localization has missing diacritics
and orthographic errors in several keys; update the JSON values for keys like
"subtitle", "language", and "manageRecordings" (and the other entries in the
reported block around lines 19–23) to use correct Brazilian Portuguese spelling
with proper accents/diacritics (e.g., "Gravação e edição de tela", "Idioma" if
different, "Abrir pasta de gravações", and similar corrections for the other
keys), ensuring consistency and proper Unicode characters across the file.
In `@src/i18n/locales/pt-BR/settings.json`:
- Around line 7-9: Update the Portuguese translation for the trim.deleteRegion
key: change the string "Excluir Regiao de Trim" to include the missing diacritic
so it reads "Excluir Região de Trim" to correct the spelling of Região.
- Around line 139-159: Update the Portuguese translations to include missing
diacritics: change the value of "quality.medium" from "Media" to "Média" and
change the value of "outputDimensions" from "Saida: {{dimensions}}px" to "Saída:
{{dimensions}}px"; locate these keys in the "export" object (e.g.,
"quality.medium" and "outputDimensions") and replace the string literals
accordingly, preserving interpolation tokens and JSON formatting.
- Around line 2-6: Update the Portuguese strings under the "zoom" object: change
the value for key "level" from "Nivel de Zoom" to "Nível de Zoom" and change the
value for key "selectRegion" from "Selecione uma regiao de zoom para ajustar" to
"Selecione uma região de zoom para ajustar" (leave the "deleteZoom" key
unchanged); locate the "zoom" object and replace those string values with the
versions that include the correct diacritical marks.
- Around line 128-138: Update the Portuguese translations in the "background"
object by correcting diacritics: change the value of "wallpaperPreview" from
"Visualizacao do papel de parede" to "Visualização do papel de parede" and
change the value of "uploadErrorDescription" from "Apenas imagens JPG e JPEG sao
suportadas." to "Apenas imagens JPG e JPEG são suportadas."; locate these keys
("wallpaperPreview" and "uploadErrorDescription") in the background block and
replace the strings accordingly.
- Around line 10-14: Update the Portuguese translations for the "speed" keys to
include proper diacritics: change the value of "playbackSpeed" from "Velocidade
de Reproducao" to "Velocidade de Reprodução", change "selectRegion" from
"Selecione uma regiao de velocidade para ajustar" to "Selecione uma região de
velocidade para ajustar", and change "deleteRegion" from "Excluir Regiao de
Velocidade" to "Excluir Região de Velocidade"; locate these keys
("playbackSpeed", "selectRegion", "deleteRegion") inside the "speed" object and
replace the strings accordingly.
- Around line 92-118: Update the Portuguese translations in the "captions"
object to include the missing diacritics: change the value for "fontSettings"
from "Configuracoes" to "Configurações", "defaultFont" from "Padrao" to
"Padrão", and "maxWidth" from "Largura Maxima" to "Largura Máxima" so the keys
in captions (fontSettings, defaultFont, maxWidth) use correct accented words.
- Around line 15-82: Update the Portuguese strings in the effects section to
include missing diacritics: change "Efeitos de Video" (key "title") to "Efeitos
de Vídeo"; change any occurrences of "camera" in keys/descriptions such as
"zoomInDescription"/"zoomOutDescription" (and any "camera"/"camera" mentions) to
"câmera"; change "Sobreposicao" (key "webcam") to "Sobreposição"; change
"Gravacao"/"gravacao" in keys like "webcamFootage", "webcamFootageDescription",
"uploadWebcamFootage", "replaceWebcamFootage", "removeWebcamFootage",
"webcamFootageAdded", "webcamFootageRemoved" to "Gravação"/"gravação" and update
"video" to "vídeo" where present (e.g., "webcamFootageDescription"); also
correct "Animacao" to "Animação" if present—ensure only string values are
edited, preserving keys and JSON structure.
- Around line 15-82: Many Portuguese strings in the "effects" block are missing
diacritics; update the translation values for keys such as
"zoomGeneralDescription", "zoomInDescription", "zoomOutDescription",
"connectedZoomDescription", "zoomInDuration", "zoomInOverlap",
"zoomOutDuration", "zoomEasingOptions" (value "snappy"), "cursorSmoothing",
"cursorSway", "webcamFootageDescription", "webcamFootageAdded",
"webcamFootageRemoved", and "padding" to include proper diacritical marks (e.g.,
"Configurações", "transição", "região"/"regiões", "conexão", "Duração",
"Sobreposição", "Rápido", "Suavização", "Oscilação", "gravação", "Gravação",
"Espaçamento"); keep keys unchanged and only modify the string values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 993f96af-d5dc-4e8e-b6d5-4464b5de7143
📒 Files selected for processing (9)
src/contexts/I18nContext.tsxsrc/i18n/config.tssrc/i18n/locales/pt-BR/common.jsonsrc/i18n/locales/pt-BR/dialogs.jsonsrc/i18n/locales/pt-BR/editor.jsonsrc/i18n/locales/pt-BR/launch.jsonsrc/i18n/locales/pt-BR/settings.jsonsrc/i18n/locales/pt-BR/shortcuts.jsonsrc/i18n/locales/pt-BR/timeline.json
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Pull Request Template
Description
Motivation
Type of Change
Related Issue(s)
Testing Guide
Checklist
Thank you for contributing!
Summary by CodeRabbit