mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: rerender i18n in host components on lang change (#6224)
This commit is contained in:
parent
e4506be3e8
commit
04a8c22f39
14 changed files with 88 additions and 72 deletions
|
@ -15,6 +15,8 @@ Please add the latest change on the top under the correct section.
|
|||
|
||||
### Features
|
||||
|
||||
- Expose `useI18n()` hook return an object containing `t()` i18n helper and current `langCode`. You can use this in components you render as `<Excalidraw>` children to render any of our i18n locale strings. [#6224](https://github.com/excalidraw/excalidraw/pull/6224)
|
||||
|
||||
- [`restoreElements`](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/utils/restore#restoreelements) API now takes an optional parameter `opts` which currently supports the below attributes
|
||||
|
||||
```js
|
||||
|
|
|
@ -87,8 +87,8 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
|||
}, []);
|
||||
|
||||
return (
|
||||
<InitializeApp langCode={langCode} theme={theme}>
|
||||
<Provider unstable_createStore={() => jotaiStore} scope={jotaiScope}>
|
||||
<Provider unstable_createStore={() => jotaiStore} scope={jotaiScope}>
|
||||
<InitializeApp langCode={langCode} theme={theme}>
|
||||
<App
|
||||
onChange={onChange}
|
||||
initialData={initialData}
|
||||
|
@ -118,8 +118,8 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
|||
>
|
||||
{children}
|
||||
</App>
|
||||
</Provider>
|
||||
</InitializeApp>
|
||||
</InitializeApp>
|
||||
</Provider>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -198,7 +198,7 @@ export {
|
|||
isInvisiblySmallElement,
|
||||
getNonDeletedElements,
|
||||
} from "../../element";
|
||||
export { defaultLang, languages } from "../../i18n";
|
||||
export { defaultLang, useI18n, languages } from "../../i18n";
|
||||
export {
|
||||
restore,
|
||||
restoreAppState,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue