Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation returns [object Object] #188

Open
sowmiyaseshadriii opened this issue Jul 31, 2019 · 1 comment
Open

translation returns [object Object] #188

sowmiyaseshadriii opened this issue Jul 31, 2019 · 1 comment

Comments

@sowmiyaseshadriii
Copy link

Hi Team,

I would like to know how to stringify the [object Object] in the i18next translation.
the configuration and translation all works fine but when i try to fetch whole object , it shows up
[object Object]

//en.json
{
"country":{
   "SG": "Singapore",
   "IN": "India",
   "AU": "Australia"
 }
}
//front end (ejs)
<div>
              <select class="form-control">
                  <option><%-t("country",{returnObjects: true})%></option> // shows [object Object]
                </select>
</div>

can you please help , tried JSON.stringify like below

<%-t(JSON.stringify("country"),{returnObjects: true})%> // shows country
@jamuhl
Copy link
Member

jamuhl commented Jul 31, 2019

<option><%-JSON.stringify(t("country",{returnObjects: true}))%></option>

should work

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

No branches or pull requests

2 participants