Sort and Compare Locale keys #882
Unanswered
timheerwagen
asked this question in
Q&A
Replies: 1 comment
-
You can sort them creating an script and running then this script in your pre-commit: const fs = require('fs')
const config = require('i18n.js')
const sortJson = require('sort-json')
Object.keys(config.locales).forEach((lang) => {
const dir = `src/locales/${lang}`
const files = fs.readdirSync(dir)
files.forEach((file) => {
sortJson.overwrite(`${dir}/${file}`)
})
}) To log the missing keys you can use the |
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
-
I am currently still looking for a good solution to sort language files and compare different languages for missing keys.
The only solution I found was currently only this eslint plugin: https://github.com/godaddy/eslint-plugin-i18n-json
This unfortunately only works partially, has a vulnerable peer dependency and also isn't maintained anymore.
Beta Was this translation helpful? Give feedback.
All reactions