fix(localization): incorrect locale when first entering (#3968)

This commit is contained in:
YANG QIA 2024-04-08 21:47:45 +08:00 committed by GitHub
parent d46dc75125
commit a82e8a1ed6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,7 +119,7 @@ export class LocalizationManagementPlugin extends Plugin {
await next(); await next();
const { resourceName, actionName } = ctx.action.params; const { resourceName, actionName } = ctx.action.params;
if (resourceName === 'app' && actionName === 'getLang') { if (resourceName === 'app' && actionName === 'getLang') {
const custom = await this.resources.getResources(ctx.get('X-Locale') || 'en-US'); const custom = await this.resources.getResources(ctx.body.lang || 'en-US');
const appLang = ctx.body; const appLang = ctx.body;
const resources = { ...appLang.resources }; const resources = { ...appLang.resources };
Object.keys(custom).forEach((key) => { Object.keys(custom).forEach((key) => {