Skip to content

Commit 553dd60

Browse files
committed
fix: Use languages.js
1 parent eec6144 commit 553dd60

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

scripts/mark-plugin-sites.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,24 @@
33
import { fileURLToPath } from 'url';
44
import fs from 'fs';
55
import path, { dirname } from 'path';
6+
import languages from './languages.js';
67

78
const __filename = fileURLToPath(import.meta.url);
89
const __dirname = dirname(__filename);
910
const reportFile = path.join(__dirname, '..', 'broken-sites-report.json');
1011
const missedFile = path.join(__dirname, '..', 'missed-sites-report.json');
1112
const pluginDir = path.join(__dirname, '..', 'plugins');
1213

13-
// Language lookup likely incomplete
14-
const langLookup = {
15-
'‎العربية': 'arabic',
16-
'chinese': 'chinese',
17-
'English': 'english',
18-
'Français': 'french',
19-
'Bahasa Indonesia': 'indonesian',
20-
'japanese': 'japanese',
21-
'korean': 'korean',
22-
'polish': 'polish',
23-
'Português': 'portuguese',
24-
'Русский': 'russian',
25-
'Español': 'spanish',
26-
'thai': 'thai',
27-
'Türkçe': 'turkish',
28-
'Українська': 'ukrainian',
29-
'Tiếng Việt': 'vietnamese',
30-
};
14+
// Languages.js is backwards from what I want
15+
function swap(json) {
16+
var ret = {};
17+
for (var key in json) {
18+
ret[json[key]] = key;
19+
}
20+
return ret;
21+
}
22+
23+
const langLookup = swap(languages);
3124

3225
async function renameFile(oldFile, newFileInject = '.broken') {
3326
try {

0 commit comments

Comments
 (0)