~cytrogen/masto-fe

ref: 4b4a9f981f7edb321b6c8e8c0c689fa77e1b550d masto-fe/app/javascript/mastodon/service_worker/web_push_locales.js -rw-r--r-- 1.4 KiB
4b4a9f98 — tobi [chore] Update to yarn 4 (#90) 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-disable import/no-commonjs --
   We need to use CommonJS here as its imported into a preval file (`emoji_compressed.js`) */

/* @preval */

const fs   = require('fs');
const path = require('path');

const filtered  = {};
const filenames = fs.readdirSync(path.resolve(__dirname, '../locales'));

filenames.forEach(filename => {
  if (!filename.match(/\.json$/)) return;

  const content = fs.readFileSync(path.resolve(__dirname, `../locales/${filename}`), 'utf-8');
  const full    = JSON.parse(content);
  const locale  = filename.split('.')[0];

  filtered[locale] = {
    'notification.favourite': full['notification.favourite'] || '',
    'notification.follow': full['notification.follow'] || '',
    'notification.follow_request': full['notification.follow_request'] || '',
    'notification.mention': full['notification.mention'] || '',
    'notification.reblog': full['notification.reblog'] || '',
    'notification.poll': full['notification.poll'] || '',
    'notification.status': full['notification.status'] || '',
    'notification.update': full['notification.update'] || '',
    'notification.admin.sign_up': full['notification.admin.sign_up'] || '',

    'status.show_more': full['status.show_more'] || '',
    'status.reblog': full['status.reblog'] || '',
    'status.favourite': full['status.favourite'] || '',

    'notifications.group': full['notifications.group'] || '',
  };
});

module.exports = JSON.parse(JSON.stringify(filtered));