Skip to content

Commit 08c024c

Browse files
author
sheepzh
committed
Fix bugs of translation
1 parent cd59076 commit 08c024c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

script/crowdin/sync-translation.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { SourceFilesModel } from "@crowdin/crowdin-api-client"
66
import { groupBy } from "@util/array"
77

88
async function processDirMessage(client: CrowdinClient, file: SourceFilesModel.File, message: ItemSet, lang: CrowdinLanguage): Promise<void> {
9+
console.log(`Start to process dir message: fileName=${file.name}, lang=${lang}`)
910
const strings = await client.listStringsByFile(file.id)
1011
const stringMap = groupBy(strings, s => s.identifier, l => l[0])
1112
for (const [identifier, text] of Object.entries(message)) {
@@ -42,10 +43,11 @@ async function processDir(client: CrowdinClient, dir: Dir, branch: SourceFilesMo
4243
console.log(`find ${files.length} files of ${dir}`)
4344
const fileMap = groupBy(files, f => f.name, l => l[0])
4445
for (const [tsFilename, message] of Object.entries(messages)) {
46+
console.log(`Start to sync translations of ${dir}/${tsFilename}`)
4547
if (isIgnored(dir, tsFilename)) {
48+
console.log("Ignored file: " + tsFilename)
4649
continue
4750
}
48-
console.log(`Start to sync translations of ${tsFilename}`)
4951
const filename = tsFilename.replace('.ts', '.json')
5052
const crowdinFile = fileMap[filename]
5153
if (!crowdinFile) {
@@ -56,7 +58,7 @@ async function processDir(client: CrowdinClient, dir: Dir, branch: SourceFilesMo
5658
for (const locale of ALL_TRANS_LOCALES) {
5759
const translated = message[locale]
5860
if (!translated || !Object.keys(translated).length) {
59-
return
61+
continue
6062
}
6163
const strings = transMsg(message[locale])
6264
const crwodinLang = crowdinLangOf(locale)
@@ -69,6 +71,9 @@ async function main() {
6971
const client = getClientFromEnv()
7072
const branch = await checkMainBranch(client)
7173

74+
for (let i = 0; i < ALL_DIRS.length; i++) {
75+
76+
}
7277
for (const dir of ALL_DIRS) {
7378
await processDir(client, dir, branch)
7479
}

0 commit comments

Comments
 (0)