donphan/config/formatjs-formatter.js

15 lines
486 B
JavaScript
Raw Normal View History

2023-05-31 22:43:39 +01:00
const path = require('path');
const upstreamTranslations = require(path.join(__dirname, "../app/javascript/mastodon/locales/en.json"));
const currentTranslations = require(path.join(__dirname, "../app/javascript/flavours/glitch/locales/en.json"));
2023-05-31 22:43:39 +01:00
exports.format = (msgs) => {
const results = {};
for (const [id, msg] of Object.entries(msgs)) {
if (!upstreamTranslations[id]) {
results[id] = currentTranslations[id] || msg.defaultMessage;
}
2023-05-31 22:43:39 +01:00
}
return results;
};