Keep translation progress automatically updated inside issue instead

This commit is contained in:
Remmy Cat Stock 2022-11-06 20:23:18 +01:00 committed by Remmy Cat Stock
parent 9837f6922c
commit 40d5286775
5 changed files with 48 additions and 1343 deletions

View File

@ -0,0 +1,36 @@
name: Updates translation progress
on:
push:
branches:
- rewrite
jobs:
update-translation-progress-issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Update translation progress issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run check-translation-jsons
gh issue edit 1104 --body-file ./translation-progress.md

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ node_modules
/build
/public/build
.env
translation-progress.md
notes.md

View File

@ -23,7 +23,7 @@ Contributions very welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for more in
### Translations
[View progress](/translation-progress.md)
[Translation Progress](https://github.com/Sendouc/sendou.ink/issues/1104)
sendou.ink can be translated to any language. All the translations can be found in the [locales folder](./public/locales). Here is how you can contribute:
@ -39,7 +39,6 @@ Things to note:
- Some lines have a dynamic part like this one: `"articleBy": "by {{author}}"` in this case `{{author}}` should appear in the translated version unchanged. So in other words don't translate the part inside `{{}}`.
- There is one more special syntax to keep in mind. When you translate this line `"project": "Sendou.ink is a project by <2>Sendou</2> with help from contributors:",` the `<2></2>` should appear in the translated version. The text inside these tags can change.
- To update a translation file copy the existing file, do any modifications needed and send the updated one.
- Don't update translation-progress.md file directly. There is a script for this `npm run check-translation-jsons`. If you don't know how to run it then Sendou will run it for you.
Any questions please ask Sendou!

View File

@ -92,6 +92,13 @@ for (const file of fs.readdirSync(otherLanguageTranslationPath("en"))) {
}
}
// eslint-disable-next-line no-console
console.log("no issues found inside translation files");
if (dontWrite) {
process.exit(0);
}
const markdown = createTranslationProgessMarkdown({
missingTranslations,
totalTranslationCounts,
@ -104,18 +111,11 @@ const translationProgressPath = path.join(
"..",
"translation-progress.md"
);
if (dontWrite) {
if (formattedMarkdown !== fs.readFileSync(translationProgressPath, "utf8")) {
throw new Error("translation-progress.md is out of date");
}
} else {
fs.writeFileSync(translationProgressPath, formattedMarkdown);
}
fs.writeFileSync(translationProgressPath, formattedMarkdown);
// eslint-disable-next-line no-console
console.log(
dontWrite ? "translation-progress.md ok" : "translation-progress.md written"
);
console.log("translation-progress.md written");
function validateNoExtraKeysInOther({
english,

File diff suppressed because it is too large Load Diff