mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 20:51:38 +08:00
feat(website): update the Crowdin
branch (#2688)
This commit is contained in:
parent
4f3dc1b0e1
commit
bd5b7e5e3f
@ -38,10 +38,10 @@ tasks:
|
|||||||
desc: Upload source files to Crowdin
|
desc: Upload source files to Crowdin
|
||||||
deps: [install]
|
deps: [install]
|
||||||
cmds:
|
cmds:
|
||||||
- npx crowdin push -b master
|
- npx crowdin push -b v2
|
||||||
|
|
||||||
crowdin:pull:
|
crowdin:pull:
|
||||||
desc: Download approved translation files from Crowdin to local
|
desc: Download approved translation files from Crowdin to local
|
||||||
deps: [install]
|
deps: [install]
|
||||||
cmds:
|
cmds:
|
||||||
- npx crowdin pull -b master --export-only-approved
|
- npx crowdin pull -b v2 --export-only-approved
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
project_id: 531392
|
project_id: "531392"
|
||||||
api_token_env: CROWDIN_PERSONAL_TOKEN
|
api_token_env: CROWDIN_PERSONAL_TOKEN
|
||||||
preserve_hierarchy: true
|
preserve_hierarchy: true
|
||||||
commit_message: "[ci skip]"
|
commit_message: "[ci skip]"
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
"clear": "docusaurus clear",
|
"clear": "docusaurus clear",
|
||||||
"serve": "docusaurus serve",
|
"serve": "docusaurus serve",
|
||||||
"write-translations": "docusaurus write-translations",
|
"write-translations": "docusaurus write-translations",
|
||||||
"write-heading-ids": "docusaurus write-heading-ids",
|
"write-heading-ids": "docusaurus write-heading-ids"
|
||||||
"crowdin": "crowdin",
|
|
||||||
"crowdin:sync": "docusaurus write-translations && crowdin upload && crowdin download"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.0",
|
"node": ">=18.14.0",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const crowdin = require("@crowdin/crowdin-api-client");
|
const crowdin = require("@crowdin/crowdin-api-client");
|
||||||
const personalToken = process.env.CROWDIN_PERSONAL_TOKEN;
|
const personalToken = process.env.CROWDIN_PERSONAL_TOKEN;
|
||||||
const projectId = 531392;
|
const projectId = "531392";
|
||||||
|
const branch = "v2";
|
||||||
|
|
||||||
// initialization of crowdin client
|
// initialization of crowdin client
|
||||||
const initClient = () => {
|
const initClient = () => {
|
||||||
@ -16,22 +17,34 @@ const initClient = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const client = initClient() || {};
|
|
||||||
|
|
||||||
async function getTranslationProgress() {
|
async function getTranslationProgress() {
|
||||||
let translationProgress = {};
|
let translationProgress = {};
|
||||||
const { translationStatusApi } = client;
|
|
||||||
|
const client = initClient() || {};
|
||||||
|
const { sourceFilesApi, translationStatusApi } = client;
|
||||||
|
|
||||||
// do nothing if client failed to init
|
// do nothing if client failed to init
|
||||||
if (!translationStatusApi) {
|
if (!translationStatusApi) {
|
||||||
return translationProgress;
|
return translationProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
await translationStatusApi.getProjectProgress(projectId).then((res) => {
|
const branchId = await sourceFilesApi
|
||||||
for (const item of res.data) {
|
.listProjectBranches(projectId)
|
||||||
translationProgress[item.data.languageId] = item.data.approvalProgress;
|
.then((res) => {
|
||||||
}
|
for (const item of res.data) {
|
||||||
});
|
if (item.data.name == branch) {
|
||||||
|
return item.data.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await translationStatusApi
|
||||||
|
.getBranchProgress(projectId, branchId)
|
||||||
|
.then((res) => {
|
||||||
|
for (const item of res.data) {
|
||||||
|
translationProgress[item.data.languageId] = item.data.approvalProgress;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return translationProgress;
|
return translationProgress;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user