formatjs-formatter.js 328 B

1234567891011
  1. const path = require('path');
  2. const currentTranslations = require(path.join(__dirname, "../app/javascript/mastodon/locales/en.json"));
  3. exports.format = (msgs) => {
  4. const results = {};
  5. for (const [id, msg] of Object.entries(msgs)) {
  6. results[id] = currentTranslations[id] || msg.defaultMessage;
  7. }
  8. return results;
  9. };