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

Add options object for t function and returnObjects option #158

Merged
merged 2 commits into from
May 23, 2020

Conversation

bickmaev5
Copy link
Contributor

Add options for t function for using like here https://www.i18next.com/translation-function/objects-and-arrays

for example we have locale like this

        'template-array': [
          {title: 'Title 1'},
          {title: 'Title 2'},
          {title: 'Title 3'}
        ],

and we need it in component as Array by returnObject option

const items = t('ns:template-array', {}, { returnObjects: true });

and use this array like this

{items.map(i => `${i.title} `)}

issue: #157

@aralroca
Copy link
Owner

Thanks for your contribution @bickmaev5 . Later when I'll have time I'm going to review it carefully!

@aralroca aralroca added this to the 0.16.0 milestone May 14, 2020
@bickmaev5
Copy link
Contributor Author

I think in my implementation there will be problems with interpolation, we will need to think what to do with it

@aralroca
Copy link
Owner

@bickmaev5 I'm sorry it took me so long to look at this. LGTM! Thank you for this contribution!

@aralroca aralroca merged commit 0072c13 into aralroca:master May 23, 2020
@aralroca
Copy link
Owner

@all-contributors add @bickmaev5 for code

@allcontributors
Copy link
Contributor

@aralroca

I've put up a pull request to add @bickmaev5! 🎉

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

Successfully merging this pull request may close these issues.

None yet

2 participants