Skip to content

Translations

Arthu Santiago edited this page Nov 30, 2026 · 1 revision

Translations

KeyAnyWhere's interface is written in Brazilian Portuguese, and every phrase goes through CakePHP's translation functions so it can be shown in other languages. Today the other language is Latin American Spanish. This page explains where the translations live, how to add a phrase without breaking the Spanish interface, and how to add a new language.

Where translations live

  • Brazilian Portuguese (pt_BR) is the source text: it is the string inside __() in the code and templates. There is no pt_BR file.
  • Spanish (es) is resources/locales/es/default.po, with the phrases of the core.
  • The list of languages offered on the Configurações gerais screen is App\I18n\Regional::IDIOMAS.

1. Add a phrase

Every new __() phrase needs its Spanish translation in resources/locales/es/default.po, in the same pull request. That includes text that elements translate for you, such as a button's texto passed to btnNovo, parts of the breadcrumb, tooltips and flash messages.

msgid "Nova entrada"
msgstr "Nueva entrada"

Flash messages are passed untranslated by the controller ($this->Flash->success('Salvo com sucesso')): the flash element translates them, so they need an entry in the .po file too.

2. Check that it worked

Clear the translation cache, set the language to Español in Configurações gerais and open the screen you changed:

bin/cake cache clear _cake_translations_

Adding a new language

  1. Create resources/locales/<locale>/default.po (for example en_US), with the same msgid entries as the Spanish file.
  2. Add the locale to Regional::IDIOMAS, with its name written in that language.
  3. Run the tests: Regional::idiomaDoNavegador() uses that list to pick the language of the first-run setup from the browser's Accept-Language header.

Next step

Contributing

Clone this wiki locally