import { Text } from "preact-i18n"; import styles from "./Panes.module.scss"; import Tip from "../../../components/ui/Tip"; import Emoji from "../../../components/common/Emoji"; import Checkbox from "../../../components/ui/Checkbox"; import { connectState } from "../../../redux/connector"; import { WithDispatcher } from "../../../redux/reducers"; import { Language, LanguageEntry, Languages as Langs } from "../../../context/Locale"; type Props = WithDispatcher & { locale: Language; } type Key = [ string, LanguageEntry ]; function Entry({ entry: [ x, lang ], locale, dispatcher }: { entry: Key } & Props) { return ( { if (v) { dispatcher({ type: "SET_LOCALE", locale: x as Language }); } }} >
{lang.display}
); } export function Component(props: Props) { const languages = Object .keys(Langs) .map(x => [ x, Langs[x as keyof typeof Langs] ]) as Key[]; return (

{languages .filter(([, lang]) => !lang.alt) .map(([x, lang]) => )}

{languages .filter(([, lang]) => lang.alt) .map(([x, lang]) => )}
{" "}
); } export const Languages = connectState( Component, state => { return { locale: state.locale }; }, true );