8000 [Feature Request] Internationalization (i18n) Support — Starting with pt-BR · Issue #2376 · block/goose · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Feature Request] Internationalization (i18n) Support — Starting with pt-BR #2376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
willy3087 opened this issue Apr 28, 2025 · 0 comments
Open
1 task done
Labels
enhancement New feature or request feature

Comments

@willy3087
Copy link

🚀 [Feature Request] Internationalization (i18n) Support — Starting with pt-BR

Hello Goose team!

I'm opening this issue to propose the addition of internationalization (i18n) support for Goose, starting with a full translation to Brazilian Portuguese (pt-BR) and a scalable system for future languages.


Why?

  • Goose is gaining traction globally, but the UI is currently English-only.
  • Supporting multiple languages will make onboarding easier for non-English speakers and help grow the community.
  • It encourages contributions of new translations from users everywhere.

What I've Done Before

I've previously implemented i18n systems in TypeScript/JavaScript projects, such as in my i18n.ts file. There, I used a modular approach with:

  • JSON translation files for each language (e.g., en.json, pt-BR.json)
  • A simple API for loading translations and switching languages at runtime
  • Fallback to default language if a key is missing
  • Integration with React components for seamless translation via hooks or HOCs

What I'm Proposing for Goose

  • Translation files: Organize translations in a /locales directory (e.g., locales/en.json, locales/pt-BR.json)
  • Translation API: Implement a utility (in JS/TS for the UI, or Rust for CLI if desired) to load language files, retrieve translations, and provide fallbacks
  • Refactor UI: Replace hardcoded strings in the React/Electron frontend with translation keys, using a hook or function like t('key')
  • Language selector: Add a language selector in the settings for users to change their preferred language
  • Documentation: Provide clear docs on how to contribute new translations
  • CLI support: (Optional, but awesome) Consider supporting i18n for CLI output as well, using a similar approach

Implementation Example

For the frontend, I suggest something similar to what I did in my previous project:

// Example: i18n.ts
import en from "./locales/en.json";
import ptBR from "./locales/pt-BR.json";

const translations = { en, "pt-BR": ptBR };
let currentLang = "en";

export function t(key: string): string {
  return translations[currentLang][key] || translations["en"][key] || key;
}

export function setLanguage(lang: string) {
  currentLang = lang;
}

And then in React:

import { t } from "./i18n";
<span>{t("welcome_message")}</span>;

This approach is simple, scalable, and battle-tested.


🇧🇷 [Sugestão de Feature] Suporte a Internacionalização (i18n) — Começando pelo pt-BR

Fala, time Goose!

Tô abrindo essa issue pra sugerir a adição de suporte a internacionalização (i18n) no Goose, começando com uma tradução completa pra português brasileiro (pt-BR) e um sistema fácil de expandir pra qualquer idioma maluco que o povo inventar.


Por que isso?

  • O Goose tá ficando famoso no mundo todo, mas a interface ainda é só em inglês (tristeza pra quem só sabe pedir "um pão na chapa").
  • Suporte a múltiplos idiomas facilita a vida de quem não manja inglês e faz a comunidade crescer.
  • Incentiva a galera a contribuir com traduções (imagina um Goose em japonês, que chique!).

O que eu já fiz antes

Já implementei sistemas de i18n em projetos TypeScript/JavaScript, tipo no meu i18n.ts. Lá eu usei:

  • Arquivos JSON pra cada idioma (en.json, pt-BR.json, etc)
  • Uma API simples pra carregar as traduções e trocar de idioma em tempo real
  • Fallback pro idioma padrão se faltar alguma chave
  • Integração com componentes React usando hooks ou HOCs (pra traduzir tudo sem dor de cabeça)

O que eu proponho pro Goose

  • Arquivos de tradução: Organizar tudo numa pasta /locales (locales/en.json, locales/pt-BR.json)
  • API de tradução: Criar um utilitário (em JS/TS pra UI, ou Rust pro CLI se quiserem ser ousados) pra carregar os arquivos, buscar traduções e garantir fallback
  • Refatorar a UI: Trocar todos os textos "hardcoded" por chaves de tradução, usando um hook ou função tipo t('key')
  • Seletor de idioma: Adicionar um seletor de idioma nas configurações (nada de menu escondido, hein)
  • Documentação: Explicar direitinho como contribuir com novas traduções
  • Suporte ao CLI: (Opcional, mas seria lindo) Pensar em internacionalizar a saída do CLI também

Exemplo de implementação

No frontend, sugiro algo assim:

// Exemplo: i18n.ts
import en from "./locales/en.json";
import ptBR from "./locales/pt-BR.json";

const translations = { en, "pt-BR": ptBR };
let currentLang = "en";

export function t(key: string): string {
  return translations[currentLang][key] || translations["en"][key] || key;
}

export function setLanguage(lang: string) {
  currentLang = lang;
}

E no React:

import { t } from "./i18n";
<span>{t("welcome_message")}</span>;

Simples, escalável e já testado até por pato!


O que pretendo fazer

  • Implementar o sistema de i18n como descrito
  • Traduzir tudo pra pt-BR (com direito a piadinha e tudo)
  • Deixar fácil pra galera adicionar mais idiomas depois

Observações

  • Se já tiverem algum plano ou começo de i18n, me avisem pra não reinventar a roda!
  • Quero deixar tudo automatizado e escalável pra quem quiser contribuir no futuro.
  • Posso ajudar a revisar PRs de novos idiomas ou melhorias!

Valeu por considerar!
— Dev5


Describe alternatives you've considered

EN:
Keeping the UI English-only, but that limits adoption and excludes non-English speakers. Also considered using third-party i18n libraries, but a simple, custom solution is easier to maintain and contribute to in this context.

PT-BR:
Deixar tudo só em inglês, mas aí só gringo usa! Também pensei em usar libs de terceiros, mas um sistema próprio deixa tudo mais enxuto, fácil de manter e de contribuir.


Additional context

  • Prior experience with i18n systems (see i18n.ts)
  • Code samples above
  • Willingness to help review PRs for other languages
  • Fun guaranteed 😁

  • I have verified this does not duplicate an existing feature request
@linear linear bot added enhancement New feature or request feature labels Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

No branches or pull requests

1 participant
0