mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-04-21 23:37:55 +00:00
fix: preserve /citizens path in i18n URL rewriting
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pezkuwi-telegram-miniapp",
|
||||
"version": "1.0.197",
|
||||
"version": "1.0.198",
|
||||
"type": "module",
|
||||
"description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards",
|
||||
"author": "Pezkuwichain Team",
|
||||
|
||||
+8
-3
@@ -139,9 +139,14 @@ export function LanguageProvider({ children }: LanguageProviderProps) {
|
||||
document.documentElement.lang = lang === 'krd' ? 'ku' : lang;
|
||||
document.documentElement.dir = isRTL ? 'rtl' : 'ltr';
|
||||
|
||||
// Ensure URL has language prefix (preserve query params like ?page=citizen)
|
||||
const firstSegment = window.location.pathname.split('/').filter(Boolean)[0];
|
||||
if (!firstSegment || !VALID_LANGS.includes(firstSegment as LanguageCode)) {
|
||||
// Ensure URL has language prefix (preserve query params and special paths)
|
||||
const pathSegments = window.location.pathname.split('/').filter(Boolean);
|
||||
const firstSegment = pathSegments[0];
|
||||
// Don't rewrite URL for standalone pages like /citizens
|
||||
const STANDALONE_PATHS = ['citizens'];
|
||||
if (firstSegment && STANDALONE_PATHS.includes(firstSegment)) {
|
||||
// Keep standalone path as-is
|
||||
} else if (!firstSegment || !VALID_LANGS.includes(firstSegment as LanguageCode)) {
|
||||
window.history.replaceState(null, '', `/${lang}${window.location.search}`);
|
||||
}
|
||||
}, [lang, isRTL]);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.197",
|
||||
"buildTime": "2026-02-14T21:06:30.802Z",
|
||||
"buildNumber": 1771103190812
|
||||
"version": "1.0.198",
|
||||
"buildTime": "2026-02-14T21:14:54.393Z",
|
||||
"buildNumber": 1771103694399
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user