Skip to content

feat(i18n): translate the remaining hardcoded texts through language tokens - #32

Open
lbrunofidelis wants to merge 2 commits into
devfrom
feat/#29-improve-pt-br-translations
Open

lbrunofidelis wants to merge 2 commits into
devfrom
feat/#29-improve-pt-br-translations

Conversation

@lbrunofidelis

Copy link
Copy Markdown
Collaborator

PR atrelado

  • API #31: cria o arquivo canônico do PT-BR, aplicado a cada migrate-database, e os tokens em inglês que este PR passa a usar (migração 2.58.3). Sem ele, o diálogo e o aviso mostrariam a chave do token.

Por que

Alguns textos da interface não passavam pelos tokens de idioma, então não acompanhavam o idioma escolhido. O diálogo "Consulta via API" da lista de contatos e o item de menu dele estavam fixos em português. O aviso exibido quando a criação de um relacionamento falha estava fixo em inglês ("Something went wrong..."). O arquivo local de português (src/app/i18n/portuguese_pt.ts) estava em português de Portugal: "utilizador", "equipa", "Visualiza múltiplas localidades".

Causa

Os textos estavam escritos direto em contacts-list.component.ts e em relationships-create-view-modify.component.ts, em vez de referenciar tokens LNG_*. O arquivo local de português foi escrito em PT-PT.

O que muda

  1. contacts-list.component.ts: o item de menu e o diálogo "Consulta via API" usam os tokens LNG_PAGE_LIST_CONTACTS_ACTION_API_QUERY e LNG_PAGE_LIST_CONTACTS_API_QUERY_DIALOG_*.
  2. relationships-create-view-modify.component.ts: o aviso usa LNG_PAGE_CREATE_ENTITY_RELATIONSHIP_ERROR_SOMETHING_WENT_WRONG.
  3. src/app/i18n/portuguese_pt.ts: textos em PT-BR, iguais aos do arquivo canônico da API (notificações de equipe, "Ver vários locais").

Como validar

  1. Com o PR da API aplicado e npm run migrate-database executado, abra a lista de contatos em Português e em Inglês: o item "Consulta via API" e o diálogo aparecem no idioma escolhido.
  2. Troque o idioma para Inglês: os mesmos textos aparecem em inglês.

Validado

  • npm run build (produção) ok.
  • eslint nos 3 arquivos tocados: sem erros.
  • Os 7 tokens usados existem no english_us base, na migração 2.58.3 e no canônico PT-BR da API (check da API com 0 findings).

Fora do escopo

  • Idioma padrão: continua english_us.

Linked PR

  • API #31: adds the canonical PT-BR file, applied on every migrate-database, and the English tokens this PR now uses (migration 2.58.3). Without it the dialog and the warning would show the token key.

Why (English)

Some UI texts bypassed the language tokens, so they did not follow the selected language. The contacts list "API query" dialog and its menu item were hardcoded in Portuguese, and the relationship creation failure warning was hardcoded in English ("Something went wrong..."). The local Portuguese file (src/app/i18n/portuguese_pt.ts) was written in European Portuguese.

Cause

The texts were written directly in contacts-list.component.ts and relationships-create-view-modify.component.ts instead of referencing LNG_* tokens, and the local Portuguese file used European Portuguese.

What changes

  1. contacts-list.component.ts: the menu item and the "API query" dialog use LNG_PAGE_LIST_CONTACTS_ACTION_API_QUERY and LNG_PAGE_LIST_CONTACTS_API_QUERY_DIALOG_*.
  2. relationships-create-view-modify.component.ts: the warning uses LNG_PAGE_CREATE_ENTITY_RELATIONSHIP_ERROR_SOMETHING_WENT_WRONG.
  3. src/app/i18n/portuguese_pt.ts: Brazilian Portuguese texts, the same as the API canonical file.

How to validate

  1. With the API PR applied and npm run migrate-database run, open the contacts list in Portuguese and in English: the "API query" item and dialog follow the selected language.

Validated

  • npm run build (production) ok.
  • eslint on the 3 touched files: no errors.

Out of scope

  • Default language: stays english_us.

The dialog and its menu item were hardcoded in Portuguese, and the relationship creation warning in English.
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