feat(i18n): i18nize everything
This commit is contained in:
@@ -10,13 +10,17 @@ const achievements = useAchievementsStore();
|
||||
const confirmationModal = useConfirmationModal();
|
||||
|
||||
const ACTIONS = {
|
||||
github: ["Open", "Github profile", "https://github.com/pihkaal"],
|
||||
email: ["Copy", "Email", "hello@pihkaal.me"],
|
||||
website: ["Copy", "Website link", "https://pihkaal.me"],
|
||||
cv: ["Open", "CV", "https://pihkaal.me/cv"],
|
||||
github: [
|
||||
"open",
|
||||
"contact.actions.githubProfile",
|
||||
"https://github.com/pihkaal",
|
||||
],
|
||||
email: ["copy", "contact.actions.email", "hello@pihkaal.me"],
|
||||
website: ["copy", "contact.actions.websiteLink", "https://pihkaal.me"],
|
||||
cv: ["open", "contact.actions.cv", "https://pihkaal.me/cv"],
|
||||
} as const satisfies Record<
|
||||
string,
|
||||
[action: "Copy" | "Open", verb: string, content: string]
|
||||
[action: "copy" | "open", verbKey: string, content: string]
|
||||
>;
|
||||
|
||||
const { selected, selectorPosition } = useButtonNavigation({
|
||||
@@ -54,20 +58,21 @@ const { selected, selectorPosition } = useButtonNavigation({
|
||||
});
|
||||
|
||||
const actionateButton = async (button: (typeof selected)["value"]) => {
|
||||
const [action, verb, content] = ACTIONS[button];
|
||||
if (action === "Copy") {
|
||||
const [action, verbKey, content] = ACTIONS[button];
|
||||
const verb = $t(verbKey);
|
||||
if (action === "copy") {
|
||||
try {
|
||||
await navigator.clipboard.writeText(content);
|
||||
store.pushNotification(`${verb} copied to clipboard`);
|
||||
store.pushNotification($t("contact.copiedToClipboard", { item: verb }));
|
||||
} catch (error) {
|
||||
console.error("Failed to copy to clipboard:", error);
|
||||
}
|
||||
} else {
|
||||
const url = content.replace(/^https?:\/\//, "");
|
||||
confirmationModal.open({
|
||||
text: `Open ${url}?`,
|
||||
text: $t("contact.openUrl", { url }),
|
||||
onConfirm: async () => {
|
||||
store.pushNotification(`${verb} opened`);
|
||||
store.pushNotification($t("contact.opened", { item: verb }));
|
||||
await sleep(100);
|
||||
await navigateTo(content, { open: { target: "_blank " } });
|
||||
|
||||
@@ -94,7 +99,7 @@ const actionateButton = async (button: (typeof selected)["value"]) => {
|
||||
/>
|
||||
|
||||
<CommonBars
|
||||
title="Choose a Chat Room to join."
|
||||
:title="$t('contact.title')"
|
||||
:opacity="
|
||||
store.isIntro ? store.intro.stage3Opacity : store.outro.stage2Opacity
|
||||
"
|
||||
@@ -112,8 +117,8 @@ const actionateButton = async (button: (typeof selected)["value"]) => {
|
||||
? store.outro.stage2Opacity
|
||||
: 1
|
||||
"
|
||||
b-label="Quit"
|
||||
:a-label="ACTIONS[selected][0]"
|
||||
:b-label="$t('common.quit')"
|
||||
:a-label="$t(`contact.actions.${ACTIONS[selected][0]}`)"
|
||||
@activate-b="store.animateOutro()"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user