mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-19 22:45:06 -04:00
feat(i18n): added missing locale files in tools (#863)
This commit is contained in:
parent
1334bff30a
commit
7f5fa00147
312 changed files with 61 additions and 0 deletions
61
scripts/build-locales-files.mjs
Normal file
61
scripts/build-locales-files.mjs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
import { existsSync, writeFileSync } from 'node:fs';
|
||||||
|
import { Glob } from 'bun';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
async function getPathsFromGlobs({ patterns, onlyFiles = true }) {
|
||||||
|
const filePaths = [];
|
||||||
|
|
||||||
|
for (const pattern of patterns) {
|
||||||
|
const glob = new Glob(pattern);
|
||||||
|
|
||||||
|
for await (const filePath of glob.scan({ onlyFiles, cwd: '.' })) {
|
||||||
|
filePaths.push(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { filePaths };
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLocaleKey({ filePath }) {
|
||||||
|
const fileName = filePath.split('/').pop();
|
||||||
|
return fileName.replace(/\.yml$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createMissingLocaleFile({ localeKey }) {
|
||||||
|
const fileName = `${localeKey}.yml`;
|
||||||
|
|
||||||
|
const { filePaths: localesDirs } = await getPathsFromGlobs({
|
||||||
|
patterns: [
|
||||||
|
'locales',
|
||||||
|
'src/tools/*/locales',
|
||||||
|
],
|
||||||
|
onlyFiles: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const localesDir of localesDirs) {
|
||||||
|
const filePath = `${localesDir}/${fileName}`;
|
||||||
|
|
||||||
|
if (existsSync(filePath)) {
|
||||||
|
console.log(`Locale file already exists: ${filePath}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Creating missing locale file: ${filePath}`);
|
||||||
|
writeFileSync(filePath, '', 'utf8');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { filePaths } = await getPathsFromGlobs({
|
||||||
|
patterns: [
|
||||||
|
'locales/*.yml',
|
||||||
|
'src/tools/*/locales/*.yml',
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
_.chain(filePaths)
|
||||||
|
.map(filePath => getLocaleKey({ filePath }))
|
||||||
|
.uniq()
|
||||||
|
.map(localeKey => createMissingLocaleFile({ localeKey }))
|
||||||
|
.value(),
|
||||||
|
);
|
0
src/tools/base64-file-converter/locales/fr.yml
Normal file
0
src/tools/base64-file-converter/locales/fr.yml
Normal file
0
src/tools/base64-file-converter/locales/pt.yml
Normal file
0
src/tools/base64-file-converter/locales/pt.yml
Normal file
0
src/tools/base64-file-converter/locales/uk.yml
Normal file
0
src/tools/base64-file-converter/locales/uk.yml
Normal file
0
src/tools/base64-file-converter/locales/zh.yml
Normal file
0
src/tools/base64-file-converter/locales/zh.yml
Normal file
0
src/tools/base64-string-converter/locales/fr.yml
Normal file
0
src/tools/base64-string-converter/locales/fr.yml
Normal file
0
src/tools/base64-string-converter/locales/pt.yml
Normal file
0
src/tools/base64-string-converter/locales/pt.yml
Normal file
0
src/tools/base64-string-converter/locales/uk.yml
Normal file
0
src/tools/base64-string-converter/locales/uk.yml
Normal file
0
src/tools/base64-string-converter/locales/zh.yml
Normal file
0
src/tools/base64-string-converter/locales/zh.yml
Normal file
0
src/tools/basic-auth-generator/locales/fr.yml
Normal file
0
src/tools/basic-auth-generator/locales/fr.yml
Normal file
0
src/tools/basic-auth-generator/locales/pt.yml
Normal file
0
src/tools/basic-auth-generator/locales/pt.yml
Normal file
0
src/tools/basic-auth-generator/locales/uk.yml
Normal file
0
src/tools/basic-auth-generator/locales/uk.yml
Normal file
0
src/tools/basic-auth-generator/locales/zh.yml
Normal file
0
src/tools/basic-auth-generator/locales/zh.yml
Normal file
0
src/tools/bcrypt/locales/fr.yml
Normal file
0
src/tools/bcrypt/locales/fr.yml
Normal file
0
src/tools/bcrypt/locales/pt.yml
Normal file
0
src/tools/bcrypt/locales/pt.yml
Normal file
0
src/tools/bcrypt/locales/uk.yml
Normal file
0
src/tools/bcrypt/locales/uk.yml
Normal file
0
src/tools/bcrypt/locales/zh.yml
Normal file
0
src/tools/bcrypt/locales/zh.yml
Normal file
0
src/tools/benchmark-builder/locales/fr.yml
Normal file
0
src/tools/benchmark-builder/locales/fr.yml
Normal file
0
src/tools/benchmark-builder/locales/pt.yml
Normal file
0
src/tools/benchmark-builder/locales/pt.yml
Normal file
0
src/tools/benchmark-builder/locales/uk.yml
Normal file
0
src/tools/benchmark-builder/locales/uk.yml
Normal file
0
src/tools/benchmark-builder/locales/zh.yml
Normal file
0
src/tools/benchmark-builder/locales/zh.yml
Normal file
0
src/tools/bip39-generator/locales/fr.yml
Normal file
0
src/tools/bip39-generator/locales/fr.yml
Normal file
0
src/tools/bip39-generator/locales/pt.yml
Normal file
0
src/tools/bip39-generator/locales/pt.yml
Normal file
0
src/tools/bip39-generator/locales/uk.yml
Normal file
0
src/tools/bip39-generator/locales/uk.yml
Normal file
0
src/tools/bip39-generator/locales/zh.yml
Normal file
0
src/tools/bip39-generator/locales/zh.yml
Normal file
0
src/tools/camera-recorder/locales/fr.yml
Normal file
0
src/tools/camera-recorder/locales/fr.yml
Normal file
0
src/tools/camera-recorder/locales/pt.yml
Normal file
0
src/tools/camera-recorder/locales/pt.yml
Normal file
0
src/tools/camera-recorder/locales/uk.yml
Normal file
0
src/tools/camera-recorder/locales/uk.yml
Normal file
0
src/tools/camera-recorder/locales/zh.yml
Normal file
0
src/tools/camera-recorder/locales/zh.yml
Normal file
0
src/tools/case-converter/locales/fr.yml
Normal file
0
src/tools/case-converter/locales/fr.yml
Normal file
0
src/tools/case-converter/locales/pt.yml
Normal file
0
src/tools/case-converter/locales/pt.yml
Normal file
0
src/tools/case-converter/locales/uk.yml
Normal file
0
src/tools/case-converter/locales/uk.yml
Normal file
0
src/tools/case-converter/locales/zh.yml
Normal file
0
src/tools/case-converter/locales/zh.yml
Normal file
0
src/tools/chmod-calculator/locales/fr.yml
Normal file
0
src/tools/chmod-calculator/locales/fr.yml
Normal file
0
src/tools/chmod-calculator/locales/pt.yml
Normal file
0
src/tools/chmod-calculator/locales/pt.yml
Normal file
0
src/tools/chmod-calculator/locales/uk.yml
Normal file
0
src/tools/chmod-calculator/locales/uk.yml
Normal file
0
src/tools/chmod-calculator/locales/zh.yml
Normal file
0
src/tools/chmod-calculator/locales/zh.yml
Normal file
0
src/tools/chronometer/locales/fr.yml
Normal file
0
src/tools/chronometer/locales/fr.yml
Normal file
0
src/tools/chronometer/locales/pt.yml
Normal file
0
src/tools/chronometer/locales/pt.yml
Normal file
0
src/tools/chronometer/locales/uk.yml
Normal file
0
src/tools/chronometer/locales/uk.yml
Normal file
0
src/tools/chronometer/locales/zh.yml
Normal file
0
src/tools/chronometer/locales/zh.yml
Normal file
0
src/tools/color-converter/locales/fr.yml
Normal file
0
src/tools/color-converter/locales/fr.yml
Normal file
0
src/tools/color-converter/locales/pt.yml
Normal file
0
src/tools/color-converter/locales/pt.yml
Normal file
0
src/tools/color-converter/locales/uk.yml
Normal file
0
src/tools/color-converter/locales/uk.yml
Normal file
0
src/tools/color-converter/locales/zh.yml
Normal file
0
src/tools/color-converter/locales/zh.yml
Normal file
0
src/tools/crontab-generator/locales/fr.yml
Normal file
0
src/tools/crontab-generator/locales/fr.yml
Normal file
0
src/tools/crontab-generator/locales/pt.yml
Normal file
0
src/tools/crontab-generator/locales/pt.yml
Normal file
0
src/tools/crontab-generator/locales/uk.yml
Normal file
0
src/tools/crontab-generator/locales/uk.yml
Normal file
0
src/tools/crontab-generator/locales/zh.yml
Normal file
0
src/tools/crontab-generator/locales/zh.yml
Normal file
0
src/tools/date-time-converter/locales/fr.yml
Normal file
0
src/tools/date-time-converter/locales/fr.yml
Normal file
0
src/tools/date-time-converter/locales/pt.yml
Normal file
0
src/tools/date-time-converter/locales/pt.yml
Normal file
0
src/tools/date-time-converter/locales/uk.yml
Normal file
0
src/tools/date-time-converter/locales/uk.yml
Normal file
0
src/tools/date-time-converter/locales/zh.yml
Normal file
0
src/tools/date-time-converter/locales/zh.yml
Normal file
0
src/tools/device-information/locales/fr.yml
Normal file
0
src/tools/device-information/locales/fr.yml
Normal file
0
src/tools/device-information/locales/pt.yml
Normal file
0
src/tools/device-information/locales/pt.yml
Normal file
0
src/tools/device-information/locales/uk.yml
Normal file
0
src/tools/device-information/locales/uk.yml
Normal file
0
src/tools/device-information/locales/zh.yml
Normal file
0
src/tools/device-information/locales/zh.yml
Normal file
0
src/tools/emoji-picker/locales/fr.yml
Normal file
0
src/tools/emoji-picker/locales/fr.yml
Normal file
0
src/tools/emoji-picker/locales/pt.yml
Normal file
0
src/tools/emoji-picker/locales/pt.yml
Normal file
0
src/tools/emoji-picker/locales/uk.yml
Normal file
0
src/tools/emoji-picker/locales/uk.yml
Normal file
0
src/tools/emoji-picker/locales/zh.yml
Normal file
0
src/tools/emoji-picker/locales/zh.yml
Normal file
0
src/tools/encryption/locales/fr.yml
Normal file
0
src/tools/encryption/locales/fr.yml
Normal file
0
src/tools/encryption/locales/pt.yml
Normal file
0
src/tools/encryption/locales/pt.yml
Normal file
0
src/tools/encryption/locales/uk.yml
Normal file
0
src/tools/encryption/locales/uk.yml
Normal file
0
src/tools/encryption/locales/zh.yml
Normal file
0
src/tools/encryption/locales/zh.yml
Normal file
0
src/tools/eta-calculator/locales/fr.yml
Normal file
0
src/tools/eta-calculator/locales/fr.yml
Normal file
0
src/tools/eta-calculator/locales/pt.yml
Normal file
0
src/tools/eta-calculator/locales/pt.yml
Normal file
0
src/tools/eta-calculator/locales/uk.yml
Normal file
0
src/tools/eta-calculator/locales/uk.yml
Normal file
0
src/tools/eta-calculator/locales/zh.yml
Normal file
0
src/tools/eta-calculator/locales/zh.yml
Normal file
0
src/tools/git-memo/locales/fr.yml
Normal file
0
src/tools/git-memo/locales/fr.yml
Normal file
0
src/tools/git-memo/locales/pt.yml
Normal file
0
src/tools/git-memo/locales/pt.yml
Normal file
0
src/tools/git-memo/locales/uk.yml
Normal file
0
src/tools/git-memo/locales/uk.yml
Normal file
0
src/tools/git-memo/locales/zh.yml
Normal file
0
src/tools/git-memo/locales/zh.yml
Normal file
0
src/tools/hash-text/locales/fr.yml
Normal file
0
src/tools/hash-text/locales/fr.yml
Normal file
0
src/tools/hash-text/locales/pt.yml
Normal file
0
src/tools/hash-text/locales/pt.yml
Normal file
0
src/tools/hash-text/locales/uk.yml
Normal file
0
src/tools/hash-text/locales/uk.yml
Normal file
0
src/tools/hash-text/locales/zh.yml
Normal file
0
src/tools/hash-text/locales/zh.yml
Normal file
0
src/tools/hmac-generator/locales/fr.yml
Normal file
0
src/tools/hmac-generator/locales/fr.yml
Normal file
0
src/tools/hmac-generator/locales/pt.yml
Normal file
0
src/tools/hmac-generator/locales/pt.yml
Normal file
0
src/tools/hmac-generator/locales/uk.yml
Normal file
0
src/tools/hmac-generator/locales/uk.yml
Normal file
0
src/tools/hmac-generator/locales/zh.yml
Normal file
0
src/tools/hmac-generator/locales/zh.yml
Normal file
0
src/tools/html-entities/locales/fr.yml
Normal file
0
src/tools/html-entities/locales/fr.yml
Normal file
0
src/tools/html-entities/locales/pt.yml
Normal file
0
src/tools/html-entities/locales/pt.yml
Normal file
0
src/tools/html-entities/locales/uk.yml
Normal file
0
src/tools/html-entities/locales/uk.yml
Normal file
0
src/tools/html-entities/locales/zh.yml
Normal file
0
src/tools/html-entities/locales/zh.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/fr.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/fr.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/pt.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/pt.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/uk.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/uk.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/zh.yml
Normal file
0
src/tools/html-wysiwyg-editor/locales/zh.yml
Normal file
0
src/tools/http-status-codes/locales/fr.yml
Normal file
0
src/tools/http-status-codes/locales/fr.yml
Normal file
0
src/tools/http-status-codes/locales/pt.yml
Normal file
0
src/tools/http-status-codes/locales/pt.yml
Normal file
0
src/tools/http-status-codes/locales/uk.yml
Normal file
0
src/tools/http-status-codes/locales/uk.yml
Normal file
0
src/tools/http-status-codes/locales/zh.yml
Normal file
0
src/tools/http-status-codes/locales/zh.yml
Normal file
0
src/tools/iban-validator-and-parser/locales/fr.yml
Normal file
0
src/tools/iban-validator-and-parser/locales/fr.yml
Normal file
0
src/tools/iban-validator-and-parser/locales/pt.yml
Normal file
0
src/tools/iban-validator-and-parser/locales/pt.yml
Normal file
0
src/tools/iban-validator-and-parser/locales/uk.yml
Normal file
0
src/tools/iban-validator-and-parser/locales/uk.yml
Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue