liebling/src/order-locales.js
D3473R d731556403
Automatically sort the locale json files (#144)
* npm audit fix

* Order locale files

* Update german translations
2020-03-17 21:42:55 +01:00

23 lines
518 B
JavaScript

"use strict";
const fs = require("fs");
const path = require("path");
const locales = "../locales";
fs.readdir(locales, function(err, files) {
files.forEach(function(file, index) {
const unordered = JSON.parse(fs.readFileSync(path.join(locales, file)));
const ordered = {};
Object.keys(unordered)
.sort()
.forEach(function(key) {
ordered[key] = unordered[key];
});
fs.writeFileSync(
path.join(locales, file),
JSON.stringify(ordered, null, 2)
);
});
});