Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tx support + pull updated translations #3657

Merged
merged 11 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[main]
host = https://www.transifex.com

[o:web-scrobbler:p:web-scrobbler:r:messages-json--master]
file_filter = src/_locales/<lang>/messages.json
source_file = src/_locales/en/messages.json
type = CHROME
minimum_perc = 0
resource_name = messages.json

[o:web-scrobbler:p:web-scrobbler:r:privacy-md--master]
inverse marked this conversation as resolved.
Show resolved Hide resolved
file_filter = src/_locales/<lang>/privacy.md
source_file = src/_locales/en/privacy.md
type = GITHUBMARKDOWN
minimum_perc = 0
resource_name = privacy.md

226 changes: 208 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build": "tsx build.ts",
"buildts": "tsc --project tsconfig.connectors.json",
"test": "vitest",
"lint": "eslint . && stylelint \"**/*.scss\" && remark ."
"lint": "eslint . && stylelint \"**/*.scss\" && remark .",
"translations": "tx pull -m onlytranslated && tsx scripts/translations-prepare.ts"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -52,6 +53,7 @@
"eslint-plugin-solid": "0.12.1",
"eslint-plugin-tsdoc": "0.2.17",
"fs-extra": "11.1.1",
"glob": "10.2.1",
"imagemin": "8.0.1",
"imagemin-jpegtran": "7.0.0",
"imagemin-pngquant": "9.0.2",
Expand Down
24 changes: 24 additions & 0 deletions scripts/translations-prepare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { glob } from 'glob';
import { readFile, writeFile } from 'fs/promises';
import colorLog from 'scripts/log';

const translationFiles = await glob('src/_locales/**/messages.json');

for (const index in translationFiles) {
const filePath = translationFiles[index];

const json = JSON.parse(await readFile(filePath));

let modified = false;
Object.keys(json).forEach((key) => {
if (json[key]['message'] === '') {
delete json[key];
modified = true;
}
});

if (modified) {
colorLog(`Updating ${filePath}`, 'info');
await writeFile(filePath, JSON.stringify(json, null, 4) + '\n');
}
}