fix: localize skin site UI and renew JWT on startup
Catalog missing skin-site messages and check source IDs during i18n validation. Renew the saved JWT before loading session data, guard overlapping login/logout requests, and reload announcements after authentication with a retry action.
This commit is contained in:
1 parent
2d7683b0bb
commit
7f3a1cdf5c
11 files changed
+4744
-2341
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { parse, TYPE } from '@formatjs/icu-messageformat-parser'
|
||||
import { collectSkinSiteMessages } from './skin-site-messages.mjs'
|
||||
|
||||
const localePairs = [
|
||||
[
|
||||
@@ -10,6 +11,22 @@ const localePairs = [
|
||||
]
|
||||
|
||||
const failures = []
|
||||
const skinSiteCatalogs = Object.fromEntries(
|
||||
await Promise.all(
|
||||
['en-US', 'zh-CN'].map(async (locale) => [
|
||||
locale,
|
||||
JSON.parse(await readFile(`apps/app-frontend/src/locales/${locale}/index.json`, 'utf8')),
|
||||
]),
|
||||
),
|
||||
)
|
||||
for (const { id, file } of collectSkinSiteMessages()) {
|
||||
for (const locale of ['en-US', 'zh-CN']) {
|
||||
const catalogPath = `apps/app-frontend/src/locales/${locale}/index.json`
|
||||
const catalog = skinSiteCatalogs[locale]
|
||||
if (!catalog[id]?.message)
|
||||
failures.push(`${catalogPath}: missing source message ${id} (${file})`)
|
||||
}
|
||||
}
|
||||
const allowedUntranslatedMessages = new Set([
|
||||
'Chaos Cubed',
|
||||
'MINECON Earth 2017',
|
||||
|
||||
Reference in new issue
Block a user