APSL/redux-i18n

Use a default language different from 'en'

brunoreis opened this issue · 2 comments

My first language is 'pt-br', but the system seems to be done in such a way that en is always the reference. Is there a way to set 'pt-br' as default and have a translation table to 'en'?

Hi!

Yes. You can call setLanguage action before your app is mounted, but don't worry, because I just created a new version (1.3.0) where you can set the initiallang when component is declared.

Please, take a look at usage section (https://github.com/APSL/redux-i18n#usage)

Best regards.

Just to keep here as a reference to others looking for it. I was able to set initiallang to have pt-br as the base reference:

<I18n translations={translations} initialLang="pt-br">

define the translations using pt-br as the keys and 'en' as a possible translation:

export const translations = {
  "en": {
    "Mensagens": "Messages",
    "Conversas": "Threads",
  }
}

And call "t" inside my component using keys in "pt-br":

const MessageStatus = (
	{...},
	{t}
) => {
	
	let text = t("Mensagens")