Localization: Fix translations are not applied sometimes
This commit is contained in:
parent
d2647df1e6
commit
801ea12b7d
@ -1,16 +1,15 @@
|
||||
import { useEffect } from '../lib/teact/teact';
|
||||
|
||||
import { ApiMediaFormat } from '../api/types';
|
||||
|
||||
import * as langProvider from '../util/langProvider';
|
||||
import useForceUpdate from './useForceUpdate';
|
||||
import useOnChange from './useOnChange';
|
||||
|
||||
export type LangFn = typeof langProvider.getTranslation;
|
||||
|
||||
export default <T extends ApiMediaFormat = ApiMediaFormat.BlobUrl>(): LangFn => {
|
||||
const forceUpdate = useForceUpdate();
|
||||
|
||||
useEffect(() => {
|
||||
useOnChange(() => {
|
||||
return langProvider.addCallback(forceUpdate);
|
||||
}, [forceUpdate]);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user