Skip to content

Using .yml file instead of .json file for translations #140

Answered by trishrempel
MyNameIsOka asked this question in Q&A
Discussion options

You must be logged in to vote

From what I've seen, i18next only supports JSON files by default.
I'd suggest finding a way to use JSON files instead, so the i18next plugins continue to work out of the box. Maybe something at build time that scans a folder with the YML files and outputs the equivalent JSON files for run-time use.

If that isn't at all possible for some reason, you could use something like the i18next-resources-to-backend plugin to use a function to load your YML resource, parse it, and return the output as JSON. The wouldn't be the most performant solution though.

Update: If you're using Webpack, you might be able to use something like the js-yaml-loader (disclaimer, I just found this through search, I h…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MyNameIsOka
Comment options

Answer selected by MyNameIsOka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants