2022-10-12 10:52:53 -04:00
|
|
|
import { Trans, useTranslation } from 'react-i18next'
|
2023-12-14 06:06:36 -05:00
|
|
|
import Close from './close'
|
|
|
|
import usePersistedState from '../hooks/use-persisted-state'
|
|
|
|
import getMeta from '../../utils/meta'
|
2022-10-12 10:52:53 -04:00
|
|
|
|
|
|
|
function TranslationMessage() {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const [hidden, setHidden] = usePersistedState('hide-i18n-notification', false)
|
2024-06-18 06:01:37 -04:00
|
|
|
const config = getMeta('ol-suggestedLanguage')!
|
|
|
|
const currentUrl = getMeta('ol-currentUrl')
|
2022-10-12 10:52:53 -04:00
|
|
|
|
|
|
|
if (hidden) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li className="system-message">
|
|
|
|
<Close onDismiss={() => setHidden(true)} />
|
|
|
|
<div className="text-center">
|
|
|
|
<a href={config.url + currentUrl}>
|
|
|
|
<Trans
|
|
|
|
i18nKey="click_here_to_view_sl_in_lng"
|
|
|
|
components={[<strong />]} // eslint-disable-line react/jsx-key
|
|
|
|
values={{ lngName: config.lngName }}
|
2023-10-19 04:27:45 -04:00
|
|
|
shouldUnescape
|
|
|
|
tOptions={{ interpolation: { escapeValue: true } }}
|
2022-10-12 10:52:53 -04:00
|
|
|
/>
|
|
|
|
<img
|
|
|
|
className="ms-1"
|
|
|
|
src={config.imgUrl}
|
|
|
|
alt={t('country_flag', { country: config.lngName })}
|
|
|
|
aria-hidden
|
|
|
|
/>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TranslationMessage
|