react-i18next doesn't translate word if putting inside parentheses

Created on 27 Jul 2020  路  5Comments  路  Source: i18next/react-i18next

馃悰 Bug Report

react-i18next doesn't translate word if putting inside parentheses

To Reproduce

Please make translation any words or sentences which inside the parentheses. For example, (this is an example).

Expected behavior

I hope the sentences or text is translated normally

Your Environment

  • runtime version: node 14.5.0, chrome 84.0.4147.89
  • i18next version: 19.5.4
  • os: Mac OS catalina 10.15.5
  • react: 16.13.1

Most helpful comment

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 馃檹

All 5 comments

Can you create a reproducable example? i.e. on codesandbox?
I have no idea what you mean.

Sorry, I made a mistake. I cannot translate text containing .
In my app, I made the en.json and enX.json
en.json:

    "apple":  "apple",
    "tree.": "tree."

enX.json:

    "apple": "appleX",
    "tree.": "tree.X"

App.js:

const App = ({ t }) => (
<div>
    {t('apple')} - {t('tree.')}
</div>
)

export default withTranslation('app')(App)

The result when I change language to enX is: appleX - tree.
But I want the result as: appleX - tree.X

I am really sorry if my expression is unclear. If there is any confusion, please let me know

if working with a flat json, it's recommended to set keySeparator to false in the init options

Thank you. It solved my problem

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 馃檹

Was this page helpful?
0 / 5 - 0 ratings