React-i18next: Possibility of dot notations instead of colon notation, in t()

Created on 26 Oct 2018  路  4Comments  路  Source: i18next/react-i18next

Hello,

Is there a way to pass keys in dot notations instead of colon notations, in t() ?

For example: t('app.page.label') instead of t('app:page:label')

Thanks,

question

Most helpful comment

@skbhardwaj I was able to get dot notation working with this:
File: i18n.js

const options = {
   ...
    keySeparator: false, 
    ...
    },
};

All 4 comments

there is no colon notation

https://www.i18next.com/translation-function/essentials#accessing-keys-in-different-namespaces

above thats the default namespace is separated by : keys by .

you can override both using nsSeparator or keySeparator

were you able to get it working like needed? if so could we close this? or else please paste your i18n.init call

@skbhardwaj I was able to get dot notation working with this:
File: i18n.js

const options = {
   ...
    keySeparator: false, 
    ...
    },
};

In detail explanation can be found here: https://react.i18next.com/guides/step-by-step-guide#3-sidequest-natural-vs-keybased-catalog

If you like this module don鈥檛 forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project -> there are many ways to help this project :pray:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jessidhia picture Jessidhia  路  4Comments

leandrocamacho picture leandrocamacho  路  4Comments

oyeanuj picture oyeanuj  路  3Comments

martinlaregina picture martinlaregina  路  3Comments

ezze picture ezze  路  4Comments