opendash
Version:
open.DASH data visualization framework
20 lines • 1.34 kB
JavaScript
import * as React from "react";
import { Modal, Select } from "antd";
import { useTranslation, useUrlParam, useLocalStorage } from "../..";
import { useOpenDashApp } from "../../hooks/useOpenDashApp";
export function LanguageSelection() {
var _a = useTranslation(["opendash"]), t = _a[0], i18n = _a[1];
var app = useOpenDashApp();
var _b = useUrlParam("opendash_language", false, "json"), showLangSelect = _b[0], setShowLangSelect = _b[1];
var _c = useLocalStorage("opendash:language"), lang = _c[0], setLang = _c[1];
return (React.createElement(Modal, { visible: showLangSelect, title: t("account.language.label"), onOk: function (e) { return setShowLangSelect(false); }, onCancel: function (e) { return setShowLangSelect(false); } },
React.createElement("p", null, t("account.language.info")),
React.createElement(Select, { placeholder: t("account.language.placeholder"), defaultValue: lang, onChange: function (nextLang) {
i18n.changeLanguage(nextLang);
setLang(nextLang);
}, style: { width: "100%" } }, app.ui.languages.map(function (_a) {
var key = _a.key, label = _a.label;
return (React.createElement(Select.Option, { key: key, value: key }, label));
}))));
}
//# sourceMappingURL=LanguageSelection.js.map