more logs
Some checks failed
CI / build-and-test (push) Failing after 3m13s

This commit is contained in:
Tobias Klemp
2026-01-02 17:22:40 +01:00
parent a89da7771a
commit aab8c84f5c

View File

@@ -77,30 +77,33 @@ class LanguageService {
if (!env.TOLGEE_API_KEY) { if (!env.TOLGEE_API_KEY) {
throw new Error('TOLGEE_API_KEY not set') throw new Error('TOLGEE_API_KEY not set')
} }
try {
const response = await fetch(url, {
method: 'GET',
headers: {
'X-API-Key': env.TOLGEE_API_KEY,
Accept: 'application/*',
},
})
const response = await fetch(url, { const zippedBuffer = await response.arrayBuffer()
method: 'GET',
headers: {
'X-API-Key': env.TOLGEE_API_KEY,
Accept: 'application/*',
},
})
const zippedBuffer = await response.arrayBuffer() const zip = await loadAsync(zippedBuffer)
const zip = await loadAsync(zippedBuffer) const translations: Record<string, TolgeeStaticData> = {}
const translations: Record<string, TolgeeStaticData> = {} for (const [filename, file] of Object.entries(zip.files)) {
if (!file.dir && filename.endsWith('.json')) {
for (const [filename, file] of Object.entries(zip.files)) { const content = await file.async('string')
if (!file.dir && filename.endsWith('.json')) { const locale = filename.replace('.json', '')
const content = await file.async('string') translations[locale] = JSON.parse(content)
const locale = filename.replace('.json', '') }
translations[locale] = JSON.parse(content)
} }
}
return translations return translations
} catch (e) {
console.error('Failed to get language data', e, JSON.stringify(e))
}
} }
} }