mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
improve translation tests
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const messagesFolder = path.resolve(__dirname, '../src/i18n_messages');
|
||||
|
||||
for (const file of fs.readdirSync(messagesFolder)) {
|
||||
const filePath = path.join(messagesFolder, file);
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const lines = content.split('\n');
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
if (line.includes('${')) {
|
||||
const index = line.indexOf('${');
|
||||
const neighborValue = 10
|
||||
const neighbor = line
|
||||
.trim()
|
||||
.slice(
|
||||
Math.max(0, index - neighborValue),
|
||||
Math.min(line.length, index + neighborValue),
|
||||
)
|
||||
console.log(`${filePath}(${i+1},${index+1}): Likely incorrect placeholder selector \$\{\}: ...${neighbor}...`);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -12,10 +12,10 @@
|
||||
"lint": "eslint .",
|
||||
"start": "npx react-native start",
|
||||
"test": "jest",
|
||||
"test:i18n": "node __tests__/missingTranslations.js && node __tests__/incorrectTranslationPlaceholders.js",
|
||||
"adb": "adb devices && adb reverse tcp:9090 tcp:9090 && adb reverse tcp:3000 tcp:3000 && adb reverse tcp:9001 tcp:9001 && adb reverse tcp:8081 tcp:8081",
|
||||
"adb:unreverse": "adb devices && adb reverse --remove-all",
|
||||
"adb:inspect": "adb shell input keyevent 82",
|
||||
"i18n:missing": "node __tests__/missingTranslations.js",
|
||||
"postinstall": "patch-package --exclude 'nothing'"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user