We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
JSON parser ignores i18n.tabStyle option and always uses spaces when saving the translation file.
i18n.tabStyle
Extension Version i18n Ally 2.2.6
To Reproduce
Solution?
I did a little digging and seems like these are the lines that cause this issue:
https://github.com/antfu/i18n-ally/blob/e2881d9f1f20ec4c849c9a0daed24d22d63eb773/src/parsers/json.ts#L21
https://github.com/antfu/i18n-ally/blob/e2881d9f1f20ec4c849c9a0daed24d22d63eb773/src/parsers/json.ts#L23
According to docs of both of these functions, you just have to specify tab char instead of number to use tabs to indent the result:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify https://www.npmjs.com/package/json-stable-stringify#space
So, all you have to do to fix this is something like this:
const indent = this.config.tab === '\t' ? this.config.tab : this.config.indent
The text was updated successfully, but these errors were encountered:
Can you make a PR? Thanks!
Sorry, something went wrong.
Sure, there it is :)
Successfully merging a pull request may close this issue.
Describe the bug
JSON parser ignores
i18n.tabStyle
option and always uses spaces when saving the translation file.Extension Version
i18n Ally 2.2.6
To Reproduce
i18n.tabStyle
to tabSolution?
I did a little digging and seems like these are the lines that cause this issue:
https://github.com/antfu/i18n-ally/blob/e2881d9f1f20ec4c849c9a0daed24d22d63eb773/src/parsers/json.ts#L21
https://github.com/antfu/i18n-ally/blob/e2881d9f1f20ec4c849c9a0daed24d22d63eb773/src/parsers/json.ts#L23
According to docs of both of these functions, you just have to specify tab char instead of number to use tabs to indent the result:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
https://www.npmjs.com/package/json-stable-stringify#space
So, all you have to do to fix this is something like this:
The text was updated successfully, but these errors were encountered: