YML loader support #308
Closed
maxinthestudio
started this conversation in
Ideas
Replies: 3 comments 2 replies
-
@maxinthestudio I like the idea of changing 2 lines of code to add yaml support. But I think we could better create a loader called |
Beta Was this translation helpful? Give feedback.
1 reply
-
As you can see, changes are minor. And you have TWO loaders now. ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi ! I was needing a yaml loader, so I took the existing I18nJsonLoader loader and I changed TWO lines:
Added this:
const yaml = require('js-yaml');
And changed this:
const data = JSON.parse(await readFile(file, 'utf8'));
for this:
const data = yaml.load(await readFile(file, 'utf8'), { json: true });
So, I was thinking, perhaps, you can add a protected method in I18nJsonLoader class ... lets say ... getDataAsJson() ... where any of us can extend that class, load whatever we want, convert that to json, and let the existing class continue its magic... what do you think ?
Thanks in advance !
Beta Was this translation helpful? Give feedback.
All reactions