translations and pickers
This commit is contained in:
+8
-6
@@ -17,7 +17,7 @@ import { api } from "@rustpad/api";
|
||||
import { copyText } from "@rustpad/clipboard";
|
||||
import { safeAppUrl } from "@rustpad/security";
|
||||
import { toast } from "@rustpad/toast";
|
||||
import { formatDateTime, populateLanguageSelect, setLanguage, t } from "@rustpad/i18n";
|
||||
import { formatDateTime, getLanguage, populateLanguageSelect, setLanguage, t } from "@rustpad/i18n";
|
||||
|
||||
function slugify(value, fallback) {
|
||||
return value.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || fallback;
|
||||
@@ -423,8 +423,9 @@ function renderAccount(session) {
|
||||
: "";
|
||||
}
|
||||
|
||||
userLabelPrimary.textContent = `Signed as ${primaryIdentity}`;
|
||||
userLabelPrimary.title = `Signed as ${primaryIdentity}`;
|
||||
const signedAs = t("profile.signedAs", { identity: primaryIdentity }, `Signed as ${primaryIdentity}`);
|
||||
userLabelPrimary.textContent = signedAs;
|
||||
userLabelPrimary.title = signedAs;
|
||||
userLabelSecondary.textContent = secondaryIdentity;
|
||||
userLabelSecondary.title = secondaryIdentity;
|
||||
userLabelSecondary.hidden = !secondaryIdentity;
|
||||
@@ -461,9 +462,9 @@ if (identityDialog) {
|
||||
document.querySelector("#profile-nickname").value = currentSession?.nickname || "";
|
||||
const profileColor = document.querySelector("#profile-color");
|
||||
profileColor.value = currentSession?.editor_color || "#7c6cff";
|
||||
const selectedTheme = currentSession?.theme || getTheme();
|
||||
const selectedTheme = getTheme();
|
||||
profileForm.querySelectorAll(`input[name="profile-theme"]`).forEach(input => { input.checked = input.value === selectedTheme; });
|
||||
populateLanguageSelect(document.querySelector("#profile-language"), currentSession?.language || "en");
|
||||
populateLanguageSelect(document.querySelector("#profile-language"), getLanguage());
|
||||
document.querySelector("#profile-current-email").value = currentSession?.email || "";
|
||||
document.querySelector("#profile-email").value = "";
|
||||
document.querySelector("#profile-new-password").value = "";
|
||||
@@ -486,8 +487,9 @@ if (identityDialog) {
|
||||
profileDialog.showModal();
|
||||
});
|
||||
document.addEventListener("rustpad:languagechange", () => {
|
||||
renderAccount(currentSession);
|
||||
if (!profileDialog?.open) return;
|
||||
populateLanguageSelect(document.querySelector("#profile-language"), currentSession?.language || "en");
|
||||
populateLanguageSelect(document.querySelector("#profile-language"), getLanguage());
|
||||
});
|
||||
document.querySelector("#close-profile")?.addEventListener("click", () => profileDialog.close());
|
||||
profileDialog?.addEventListener("click", event => { if (event.target === profileDialog) profileDialog.close(); });
|
||||
|
||||
Reference in New Issue
Block a user