Skip to content

Commit 794b37b

Browse files
committed
feat: add translation status page
1 parent ae62f9c commit 794b37b

File tree

18 files changed

+745
-8
lines changed

18 files changed

+745
-8
lines changed

app/components/AppFooter.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const showModal = () => modalRef.value?.showModal?.()
3030
<LinkBase :to="{ name: 'accessibility' }">
3131
{{ $t('a11y.footer_title') }}
3232
</LinkBase>
33+
<LinkBase :to="{ name: 'translation-status' }">
34+
{{ $t('translation_status.title') }}
35+
</LinkBase>
3336
<button
3437
type="button"
3538
class="cursor-pointer group inline-flex gap-x-1 items-center justify-center underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200"

app/components/AppHeader.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ const mobileLinks = computed<NavigationConfigWithGroups>(() => [
7373
external: false,
7474
iconClass: 'i-carbon:accessibility-alt',
7575
},
76+
{
77+
name: 'Translation Status',
78+
label: $t('translation_status.title'),
79+
to: { name: 'translation-status' },
80+
type: 'link',
81+
external: false,
82+
iconClass: 'i-lucide:languages',
83+
},
7684
],
7785
},
7886
{

app/composables/useI18nStatus.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ export function useI18nStatus() {
1818
getCachedData: (key, nuxtApp) => nuxtApp.payload.data[key] ?? nuxtApp.static.data[key],
1919
})
2020

21+
const localesMap = computed<Map<string, I18nLocaleStatus> | undefined>(() => {
22+
return status.value?.locales.reduce((acc, locale) => {
23+
acc.set(locale.lang, locale)
24+
return acc
25+
}, new Map())
26+
})
27+
2128
/**
2229
* Get the translation status for a specific locale
2330
*/
2431
function getLocaleStatus(langCode: string): I18nLocaleStatus | null {
25-
if (!status.value) return null
26-
return status.value.locales.find(l => l.lang === langCode) ?? null
32+
return localesMap.value?.get(langCode) ?? null
2733
}
2834

2935
/**
@@ -73,5 +79,7 @@ export function useI18nStatus() {
7379
isSourceLocale,
7480
/** GitHub edit URL for current locale */
7581
githubEditUrl,
82+
/** locale info map by lang */
83+
localesMap,
7684
}
7785
}

app/pages/settings.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ const setLocale: typeof setNuxti18nLocale = locale => {
258258
{{ $t('settings.help_translate') }}
259259
</a>
260260
</template>
261+
<div>
262+
<LinkBase :to="{ name: 'translation-status' }">
263+
{{ $t('settings.translation_status') }}
264+
</LinkBase>
265+
</div>
261266
</div>
262267
</section>
263268
</div>

0 commit comments

Comments
 (0)