Auth: Fix localization (#5535)
This commit is contained in:
parent
e36269f21e
commit
7eae642e18
@ -1,11 +1,11 @@
|
||||
import React, {
|
||||
memo, useCallback, useEffect, useLayoutEffect, useRef,
|
||||
memo, useCallback, useLayoutEffect, useRef,
|
||||
} from '../../lib/teact/teact';
|
||||
import { getActions, withGlobal } from '../../global';
|
||||
|
||||
import type { GlobalState } from '../../global/types';
|
||||
|
||||
import { DEFAULT_LANG_CODE, STRICTERDOM_ENABLED } from '../../config';
|
||||
import { STRICTERDOM_ENABLED } from '../../config';
|
||||
import { disableStrict, enableStrict } from '../../lib/fasterdom/stricterdom';
|
||||
import buildClassName from '../../util/buildClassName';
|
||||
import { oldSetLanguage } from '../../util/oldLangProvider';
|
||||
@ -125,12 +125,6 @@ const AuthCode = ({
|
||||
return undefined;
|
||||
}, [isConnected, authQrCode, isQrMounted, markQrMounted, unmarkQrMounted, qrCode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected) {
|
||||
void oldSetLanguage(DEFAULT_LANG_CODE);
|
||||
}
|
||||
}, [isConnected]);
|
||||
|
||||
const handleLangChange = useCallback(() => {
|
||||
markIsLoading();
|
||||
|
||||
|
||||
@ -322,7 +322,6 @@ export const DELETED_COMMENTS_CHANNEL_ID = '-1000000000777';
|
||||
export const MAX_MEDIA_FILES_FOR_ALBUM = 10;
|
||||
export const MAX_ACTIVE_PINNED_CHATS = 5;
|
||||
export const SCHEDULED_WHEN_ONLINE = 0x7FFFFFFE;
|
||||
export const DEFAULT_LANG_CODE = 'en';
|
||||
export const LANG_PACKS = ['android', 'ios', 'tdesktop', 'macos'] as const;
|
||||
export const FEEDBACK_URL = 'https://bugs.telegram.org/?tag_ids=41&sort=time';
|
||||
export const FAQ_URL = 'https://telegram.org/faq';
|
||||
|
||||
@ -17,7 +17,7 @@ export default function useLangString(key: RegularLangKey, langCode?: string) {
|
||||
langPack: LANG_PACK,
|
||||
keys: [key],
|
||||
});
|
||||
const langString = result?.strings[0];
|
||||
const langString = result?.strings[key];
|
||||
if (!langString || typeof langString !== 'string') return undefined;
|
||||
return langString;
|
||||
});
|
||||
|
||||
@ -4,7 +4,7 @@ import type { ApiOldLangPack, ApiOldLangString } from '../api/types';
|
||||
import type { LangCode, TimeFormat } from '../types';
|
||||
|
||||
import {
|
||||
DEFAULT_LANG_CODE, LANG_CACHE_NAME, LANG_PACKS,
|
||||
LANG_CACHE_NAME, LANG_PACKS,
|
||||
} from '../config';
|
||||
import { callApi } from '../api/gramjs';
|
||||
import * as cacheApi from './cacheApi';
|
||||
@ -229,7 +229,7 @@ async function fetchRemote(langCode: string): Promise<ApiOldLangPack | undefined
|
||||
}
|
||||
|
||||
function getPluralOption(amount: number) {
|
||||
const langCode = currentLangCode || DEFAULT_LANG_CODE;
|
||||
const langCode = currentLangCode || 'en';
|
||||
const optionIndex = PLURAL_RULES[langCode as keyof typeof PLURAL_RULES]
|
||||
? PLURAL_RULES[langCode as keyof typeof PLURAL_RULES](amount)
|
||||
: 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user