Commit 9cfd6e51ee778dc16e35913b12823e4b573afbfb
add translation check
mix irving committed on 8/28/2017, 1:42:43 AMParent: ef08c9119e733198510e57b49ae441a7d0c8cae7
Files changed
README.md | changed |
package-lock.json | changed |
package.json | changed |
translations/checker.js | added |
README.md | ||
---|---|---|
@@ -49,4 +49,9 @@ | ||
49 | 49 … | "autoinvite": "128.199.132.182:43750:@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519~YC4ZnjHH8qzsyHe2sihW8WDlhxSUH33IthOi4EsldwQ=" |
50 | 50 … | } |
51 | 51 … | ``` |
52 | 52 … | |
53 … | +### Translations | |
54 … | + | |
55 … | +Theses are in `/translations`. | |
56 … | +There's a helper script in there called `checker.js` which looks for translations in `en` (english) that are missing from `zh` (mandarin). | |
57 … | + |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 199182 bytes New file size: 199493 bytes |
package.json | ||
---|---|---|
@@ -58,7 +58,8 @@ | ||
58 | 58 … | "suggest-box": "^2.2.3", |
59 | 59 … | "url": "^0.11.0" |
60 | 60 … | }, |
61 | 61 … | "devDependencies": { |
62 | - "electron": "~1.6.11" | |
62 … | + "electron": "~1.6.11", | |
63 … | + "flat": "^4.0.0" | |
63 | 64 … | } |
64 | 65 … | } |
translations/checker.js | ||
---|---|---|
@@ -1,0 +1,20 @@ | ||
1 … | +// this is a script to help spot missing translations! | |
2 … | + | |
3 … | +const merge = require('lodash/mergeWith') | |
4 … | +const flat = require('flat') | |
5 … | + | |
6 … | +const en = flat(require('./en')) | |
7 … | +const zh = flat(require('./zh')) | |
8 … | + | |
9 … | +function customizer (objVal, srcVal, key, obj, src, stack) { | |
10 … | + // See docs https://lodash.com/docs/4.17.4#mergeWith | |
11 … | + | |
12 … | + if (objVal == undefined) { // implies zh is missing key | |
13 … | + if (typeof srcVal == 'string') console.log(key, '=', srcVal) | |
14 … | + } | |
15 … | +} | |
16 … | + | |
17 … | + | |
18 … | +merge(zh, en, customizer) | |
19 … | +// signature: obj, src, customizer | |
20 … | +// order matters because of customizer |
Built with git-ssb-web