Skip to content

Commit

Permalink
Prettify index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyo committed Mar 25, 2024
1 parent 4badcc1 commit 761f8e4
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@

function setUpPressInfoModal() {
const pressInfoButton = document.querySelector('#press-info');
const dialog = document.querySelector('dialog');
const pressInfoButton = document.querySelector("#press-info");
const dialog = document.querySelector("dialog");

pressInfoButton.addEventListener('click', () => dialog.showModal());
pressInfoButton.addEventListener("click", (e) => {
e.preventDefault();
dialog.showModal();
});
}

async function localize() {
const { useL10n } = await import('./lib/i18n/use-l10n.js');
const [getUILanguage, getPreferredLanguage, translateInto] = useL10n({ filesPath: './l10n/' });
const { useL10n } = await import("./lib/i18n/use-l10n.js");
const [getUILanguage, getPreferredLanguage, translateInto] = useL10n({
filesPath: "./l10n/",
});
const langSwitcher = document.querySelector("#lang-switcher");

langSwitcher.addEventListener('change', (e) => translateInto(e.target.value));
langSwitcher.addEventListener("change", (e) => translateInto(e.target.value));

if (getUILanguage() !== getPreferredLanguage()) {
await translateInto(getPreferredLanguage());
Expand All @@ -20,6 +24,5 @@ async function localize() {
langSwitcher.value = getUILanguage();
}


setUpPressInfoModal();
localize();
localize();

0 comments on commit 761f8e4

Please sign in to comment.