feat: enhance player panel and draw status handling
- Refactored PlayerPanel layout for improved title positioning and responsiveness. - Added new function to check if betting is blocked based on hall status. - Updated HallDrawPanel to utilize the new betting status check and display appropriate messages. - Enhanced i18n support with new notices for review and non-bettable states across multiple languages.
This commit is contained in:
@@ -53,17 +53,6 @@ const resources = {
|
||||
Record<(typeof namespaces)[number], Record<string, unknown>>
|
||||
>;
|
||||
|
||||
function resolveInitialLanguage(): AppLanguage {
|
||||
// SSR 始终使用默认语言,避免首屏渲染依赖浏览器状态
|
||||
if (typeof window === "undefined") {
|
||||
return DEFAULT_LANGUAGE;
|
||||
}
|
||||
|
||||
const stored = window.localStorage.getItem("i18nextLng");
|
||||
const preferred = normalizeLanguage(stored ?? window.navigator.language);
|
||||
return preferred;
|
||||
}
|
||||
|
||||
export function syncDocumentLanguage(lang: AppLanguage): void {
|
||||
if (typeof document === "undefined") return;
|
||||
|
||||
@@ -83,17 +72,15 @@ export function syncPreferredLanguage(): void {
|
||||
}
|
||||
|
||||
if (!i18n.isInitialized) {
|
||||
const initialLng = resolveInitialLanguage();
|
||||
|
||||
void i18n.use(initReactI18next).init({
|
||||
resources,
|
||||
fallbackLng: DEFAULT_LANGUAGE,
|
||||
supportedLngs: ["en", "ne", "zh"],
|
||||
defaultNS: "common",
|
||||
ns: [...namespaces],
|
||||
/** 始终先用默认语言完成 SSR / 首次 hydration,避免首屏文本不一致 */
|
||||
/** 与 SSR 一致:首屏固定默认语言,hydration 后再由 syncPreferredLanguage 切换 */
|
||||
load: "languageOnly",
|
||||
lng: initialLng,
|
||||
lng: DEFAULT_LANGUAGE,
|
||||
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
|
||||
Reference in New Issue
Block a user