(editor: Editor)
| 13 | const EDITOR_TO_LOCALE_STORE: WeakMap<Editor, UseBoundStore<StoreApi<LocaleState>>> = new WeakMap() |
| 14 | |
| 15 | const getStore = (editor: Editor) => { |
| 16 | let store = EDITOR_TO_LOCALE_STORE.get(editor) |
| 17 | if (!store) { |
| 18 | store = create<LocaleState>(() => ({ |
| 19 | lang: 'en-US', |
| 20 | locales: {}, |
| 21 | })) |
| 22 | EDITOR_TO_LOCALE_STORE.set(editor, store) |
| 23 | } |
| 24 | return store |
| 25 | } |
| 26 | |
| 27 | export const Locale = { |
| 28 | getStore, |