File size: 583 Bytes
f23825d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { observer } from "mobx-react-lite"
import { FC } from "react"
import { localized } from "../common/localize/localizedString"
import { useStores } from "../main/hooks/useStores"

export interface LocalizedProps {
  children: string
  default: string
}

export const Localized: FC<LocalizedProps> = observer(
  ({ children, default: defaultValue }) => {
    const { settingStore } = useStores()
    return (
      <>
        {localized(
          children,
          defaultValue,
          settingStore.language ?? undefined,
        ) ?? defaultValue}
      </>
    )
  },
)