Skip to content

Commit 92a41dd

Browse files
committed
chore: fix translations in footer
1 parent 7976eb3 commit 92a41dd

4 files changed

Lines changed: 54 additions & 35 deletions

File tree

app/components/AppFooter.vue

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { NPMX_DOCS_SITE } from '#shared/utils/constants'
33
44
const route = useRoute()
55
const isHome = computed(() => route.name === 'index')
6+
const { t } = useI18n()
67
78
const discord = useDiscordLink()
89
const { commandPaletteShortcutLabel } = usePlatformModifierKey()
@@ -11,8 +12,8 @@ const showModal = () => modalRef.value?.showModal?.()
1112
const closeModal = () => modalRef.value?.close?.()
1213
1314
type FooterLink =
14-
| { name: string; href: string; kbd?: never; type?: never }
15-
| { name: string; type: 'button'; href?: never; kbd?: never }
15+
| { name: string; href: string; type?: never }
16+
| { name: string; type: 'button'; onClick: () => void }
1617
1718
const socialLinks = computed(() => [
1819
{
@@ -37,52 +38,53 @@ const socialLinks = computed(() => [
3738
3839
const footerSections: Array<{ label: string; links: FooterLink[] }> = [
3940
{
40-
label: 'resources',
41+
label: t('footer.resources'),
4142
links: [
4243
{
43-
name: 'footer.blog',
44-
href: 'blog',
44+
name: t('footer.blog'),
45+
href: '/blog',
4546
},
4647
{
47-
name: 'footer.about',
48-
href: 'about',
48+
name: t('footer.about'),
49+
href: '/about',
4950
},
5051
{
51-
name: 'a11y.footer_title',
52-
href: 'accessibility',
52+
name: t('a11y.footer_title'),
53+
href: '/accessibility',
5354
},
5455
{
55-
name: 'privacy_policy.title',
56-
href: 'privacy',
56+
name: t('privacy_policy.title'),
57+
href: '/privacy',
5758
},
5859
],
5960
},
6061
{
61-
label: 'features',
62+
label: t('footer.features'),
6263
links: [
6364
{
64-
name: 'shortcuts.compare',
65-
href: 'compare',
65+
name: t('shortcuts.compare'),
66+
href: '/compare',
6667
},
6768
{
68-
name: 'shortcuts.settings',
69-
href: 'settings',
69+
name: t('shortcuts.settings'),
70+
href: '/settings',
7071
},
7172
{
72-
name: 'footer.keyboard_shortcuts',
73+
name: t('footer.keyboard_shortcuts'),
7374
type: 'button',
75+
onClick: showModal,
7476
},
7577
],
7678
},
7779
{
78-
label: 'other',
80+
label: t('footer.other'),
7981
links: [
8082
{
81-
name: 'pds.title',
82-
href: 'pds',
83+
name: t('pds.title'),
84+
href: '/pds',
8385
},
8486
{
85-
name: 'footer.docs',
87+
name: t('footer.docs'),
8688
href: NPMX_DOCS_SITE,
8789
},
8890
],
@@ -91,11 +93,11 @@ const footerSections: Array<{ label: string; links: FooterLink[] }> = [
9193
</script>
9294

9395
<template>
94-
<footer class="border-t border-border md:mt-auto md:pt-8 duration-200 transition-all">
96+
<footer class="border-t border-border sm:mt-auto sm:pt-8 duration-200 transition-all">
9597
<div class="container flex flex-col gap-3">
9698
<!-- Desktop: Show all links. Mobile: Links are in MobileMenu -->
9799
<div
98-
class="hidden md:flex flex-col lg:flex-row gap-6 lg:gap-0 lg:justify-between py-3 duration-200 transition-all"
100+
class="hidden sm:flex flex-col lg:flex-row gap-6 lg:gap-0 lg:justify-between py-3 duration-200 transition-all"
99101
>
100102
<div class="flex flex-col gap-6">
101103
<div class="flex flex-col items-start gap-3">
@@ -129,22 +131,29 @@ const footerSections: Array<{ label: string; links: FooterLink[] }> = [
129131
<button
130132
v-if="link.type === 'button'"
131133
type="button"
134+
aria-haspopup="dialog"
135+
@click="link.onClick"
132136
class="cursor-pointer text-start font-mono text-fg-subtle text-sm lowercase hover:text-accent transition-colors duration-200"
133-
@click.prevent="showModal"
134137
>
135-
{{ $t(link.name) }}
138+
{{ link.name }}
136139
</button>
137140

138-
<LinkBase v-else :to="link?.href" variant="footer">
139-
{{ $t(link.name) }}
141+
<LinkBase
142+
v-else
143+
:to="link?.href"
144+
variant="link"
145+
noUnderline
146+
class="text-fg-subtle text-sm lowercase"
147+
>
148+
{{ link.name }}
140149
</LinkBase>
141150
</template>
142151
</div>
143152
</div>
144153
</div>
145154

146155
<small
147-
class="border-border py-7.75 md:border-t md:py-4 duration-200 transition-all text-xs text-fg-muted text-center md:text-start m-0"
156+
class="border-border py-7.75 sm:border-t sm:py-4 duration-200 transition-all text-xs text-fg-muted text-center sm:text-start m-0"
148157
>
149158
<span class="lg:hidden">{{ $t('non_affiliation_disclaimer') }}</span>
150159
<span class="hidden lg:block">{{ $t('trademark_disclaimer') }}</span>

app/components/Link/Base.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const props = withDefaults(
1111
* */
1212
type?: never
1313
/** Visual style of the link */
14-
variant?: 'button-primary' | 'button-secondary' | 'link' | 'footer'
14+
variant?: 'button-primary' | 'button-secondary' | 'link'
1515
/** Size (only applicable for button variants) */
1616
size?: 'sm' | 'md'
1717
/** Makes the link take full width */
@@ -62,9 +62,8 @@ const isLinkAnchor = computed(
6262
)
6363
6464
/** size is only applicable for button like links */
65-
const isFooterLink = computed(() => props.variant === 'footer')
66-
const isLink = computed(() => props.variant === 'link' || isFooterLink.value)
67-
const isButton = computed(() => !isLink.value && !isFooterLink.value)
65+
const isLink = computed(() => props.variant === 'link')
66+
const isButton = computed(() => !isLink.value)
6867
const isButtonSmall = computed(() => props.size === 'sm' && !isLink.value)
6968
const isButtonMedium = computed(() => props.size === 'md' && !isLink.value)
7069
const keyboardShortcutsEnabled = useKeyboardShortcuts()
@@ -93,7 +92,7 @@ const keyboardShortcutsEnabled = useKeyboardShortcuts()
9392
'flex': block,
9493
'inline-flex': !block,
9594
'underline-offset-[0.2rem] underline decoration-1 decoration-fg/30':
96-
!isLinkAnchor && isLink && !noUnderline && !isFooterLink,
95+
!isLinkAnchor && isLink && !noUnderline,
9796
'justify-start font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200':
9897
isLink,
9998
'justify-center font-mono border border-border rounded-md transition-all duration-200':
@@ -104,7 +103,6 @@ const keyboardShortcutsEnabled = useKeyboardShortcuts()
104103
variant === 'button-secondary',
105104
'text-bg bg-fg hover:(bg-fg/50 text-accent) focus-visible:(bg-fg/50) aria-current:(bg-fg text-bg border-fg hover:enabled:(text-bg/50))':
106105
variant === 'button-primary',
107-
'text-fg-subtle text-sm cursor-pointer lowercase': isFooterLink,
108106
}"
109107
:to="to"
110108
:aria-keyshortcuts="keyboardShortcutsEnabled ? ariaKeyshortcuts : undefined"

i18n/locales/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
"chat": "chat",
2121
"builders_chat": "builders",
2222
"keyboard_shortcuts": "keyboard shortcuts",
23-
"brand": "brand"
23+
"brand": "brand",
24+
"resources": "Resources",
25+
"features": "Features",
26+
"other": "Other"
2427
},
2528
"shortcuts": {
2629
"section": {

i18n/schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@
6666
},
6767
"brand": {
6868
"type": "string"
69+
},
70+
"resources": {
71+
"type": "string"
72+
},
73+
"features": {
74+
"type": "string"
75+
},
76+
"other": {
77+
"type": "string"
6978
}
7079
},
7180
"additionalProperties": false

0 commit comments

Comments
 (0)