mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Merge pull request #122 from project-error/feature/missing-lang-keys-script
Add script for getting missing keys
This commit is contained in:
4 files changed
+90
-8
No files matched your search
@@ -0,0 +1,77 @@
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
console.log(args);
|
||||
|
||||
const path = './src/locale/';
|
||||
|
||||
const langs = ['bh', 'es', 'fr', 'pt', 'ptbr', 'sv', 'tr'];
|
||||
|
||||
const defaultLang = 'en';
|
||||
|
||||
const langFiles = [];
|
||||
|
||||
let defaultLangFile;
|
||||
|
||||
const missingKeys = {};
|
||||
|
||||
const promises = langs
|
||||
.filter((l) => (args[0] ? args[0] === l : true))
|
||||
.map((l) => {
|
||||
return new Promise((res, rej) => {
|
||||
import(path + l + '.json')
|
||||
.then((module) => {
|
||||
langFiles.push(module.default.translation);
|
||||
res();
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
rej(e);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const Load = () => Promise.all(promises);
|
||||
|
||||
const LoadDefault = () =>
|
||||
new Promise((res, rej) => {
|
||||
import(path + defaultLang + '.json')
|
||||
.then((module) => {
|
||||
defaultLangFile = module.default.translation;
|
||||
res();
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
rej(e);
|
||||
});
|
||||
});
|
||||
|
||||
(async () => {
|
||||
const filteredLangs = langs.filter((l) => (args[0] ? args[0] === l : true));
|
||||
|
||||
await LoadDefault();
|
||||
await Load();
|
||||
let idx = 0;
|
||||
for (const file of langFiles) {
|
||||
const currLang = filteredLangs[idx];
|
||||
if (currLang === defaultLang) {
|
||||
return;
|
||||
}
|
||||
idx++;
|
||||
if (args[0] && args[0] !== currLang) {
|
||||
return;
|
||||
}
|
||||
missingKeys[currLang] = [];
|
||||
for (const dKey in defaultLangFile) {
|
||||
let exists = false;
|
||||
for (const key in file) {
|
||||
if (key === dKey) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
if (!exists) {
|
||||
missingKeys[currLang].push([dKey, defaultLangFile[dKey]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(missingKeys);
|
||||
})();
|
||||
@@ -78,6 +78,7 @@
|
||||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"scripts": {
|
||||
"i18n:missing": "node --experimental-json-modules i18n.missingKeys.js",
|
||||
"copy:config": "cp-cli ../config.json ./src/config.autogen.json",
|
||||
"start": "yarn copy:config && react-scripts start",
|
||||
"watch": "cra-build-watch --disable-chunks --build-path ../resources/html --output-filename dev.js",
|
||||
|
||||
@@ -14,8 +14,8 @@ import { useHistory, useLocation } from 'react-router-dom';
|
||||
|
||||
const NOTIFICATION_ID = 'call:current';
|
||||
|
||||
/* InjectDebugData<CallProps | boolean>([
|
||||
{
|
||||
InjectDebugData<CallProps | boolean>([
|
||||
/* {
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
data: {
|
||||
@@ -30,8 +30,8 @@ const NOTIFICATION_ID = 'call:current';
|
||||
app: 'CALL',
|
||||
method: 'callModal',
|
||||
data: true,
|
||||
},
|
||||
]); */
|
||||
}, */
|
||||
]);
|
||||
|
||||
export const useCallService = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -6,10 +6,16 @@ import Alert from './Alert';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
marginTop: '-100px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
height: '50%',
|
||||
overflow: 'auto',
|
||||
margin: '0 auto',
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
bottom: '-100px',
|
||||
right: 0,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -21,9 +27,7 @@ export const Snackbar = () => {
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
{alert ? (
|
||||
<Alert severity={alert.type}>
|
||||
{t('APPS_' + alert.message)}
|
||||
</Alert>
|
||||
<Alert severity={alert.type}>{t('APPS_' + alert.message)}</Alert>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user