mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-29 11:06:10 +00:00
web/updates: add alt text to navigation buttons
This commit is contained in:
parent
8b866ddf6f
commit
5fc893a273
4
web/i18n/en/updates.json
Normal file
4
web/i18n/en/updates.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"button.next": "go to older changelog ({{ value }})",
|
||||||
|
"button.previous": "go to newer changelog ({{ value }})"
|
||||||
|
}
|
|
@ -12,8 +12,8 @@ import languages from '$i18n/languages.json';
|
||||||
const locFiles = import.meta.glob('$i18n/*/**/*.json');
|
const locFiles = import.meta.glob('$i18n/*/**/*.json');
|
||||||
const parsedLocfiles: StructuredLocfileInfo = {};
|
const parsedLocfiles: StructuredLocfileInfo = {};
|
||||||
|
|
||||||
for (const [ path, loader ] of Object.entries(locFiles)) {
|
for (const [path, loader] of Object.entries(locFiles)) {
|
||||||
const [,, lang, ...keyComponents ] = path.split('/');
|
const [, , lang, ...keyComponents] = path.split('/');
|
||||||
const key = keyComponents.map(k => k.replace('.json', '')).join('.');
|
const key = keyComponents.map(k => k.replace('.json', '')).join('.');
|
||||||
parsedLocfiles[lang] = {
|
parsedLocfiles[lang] = {
|
||||||
...parsedLocfiles[lang],
|
...parsedLocfiles[lang],
|
||||||
|
@ -22,7 +22,9 @@ for (const [ path, loader ] of Object.entries(locFiles)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultLocale = 'en';
|
const defaultLocale = 'en';
|
||||||
const config: Config = {
|
const config: Config<{
|
||||||
|
value?: string;
|
||||||
|
}> = {
|
||||||
fallbackLocale: defaultLocale,
|
fallbackLocale: defaultLocale,
|
||||||
translations: Object.keys(parsedLocfiles).reduce((obj, lang) => {
|
translations: Object.keys(parsedLocfiles).reduce((obj, lang) => {
|
||||||
return {
|
return {
|
||||||
|
@ -30,8 +32,8 @@ const config: Config = {
|
||||||
[lang]: { languages }
|
[lang]: { languages }
|
||||||
}
|
}
|
||||||
}, {}),
|
}, {}),
|
||||||
loaders: Object.entries(parsedLocfiles).map(([ lang, keys ]) => {
|
loaders: Object.entries(parsedLocfiles).map(([lang, keys]) => {
|
||||||
return Object.entries(keys).map(([ key, importer ]) => {
|
return Object.entries(keys).map(([key, importer]) => {
|
||||||
return {
|
return {
|
||||||
locale: lang,
|
locale: lang,
|
||||||
key,
|
key,
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
wrapper.scrollTop += e.deltaY;
|
wrapper.scrollTop += e.deltaY;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$: prev = versions[currentIndex - 1];
|
$: prev = versions[currentIndex - 1];
|
||||||
$: next = versions[currentIndex + 1];
|
$: next = versions[currentIndex + 1];
|
||||||
|
@ -80,20 +80,16 @@
|
||||||
</title>
|
</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<svelte:window
|
<svelte:window on:keydown={handleKeydown} />
|
||||||
on:keydown={handleKeydown}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div
|
<div class="news" tabindex="-1" data-focus-ring-hidden on:wheel={handleScroll}>
|
||||||
class="news"
|
|
||||||
tabindex="-1"
|
|
||||||
data-focus-ring-hidden
|
|
||||||
on:wheel={handleScroll}
|
|
||||||
>
|
|
||||||
{#if changelog}
|
{#if changelog}
|
||||||
<div id="left-button" class="button-wrapper-desktop">
|
<div id="left-button" class="button-wrapper-desktop">
|
||||||
{#if prev}
|
{#if prev}
|
||||||
<button on:click={loadPrev}>
|
<button
|
||||||
|
on:click={loadPrev}
|
||||||
|
aria-label={$t("updates.button.previous", { value: prev })}
|
||||||
|
>
|
||||||
<IconArrowLeft />
|
<IconArrowLeft />
|
||||||
{prev || ""}
|
{prev || ""}
|
||||||
</button>
|
</button>
|
||||||
|
@ -114,7 +110,10 @@
|
||||||
|
|
||||||
<div class="button-wrapper-mobile" class:only-right={!prev}>
|
<div class="button-wrapper-mobile" class:only-right={!prev}>
|
||||||
{#if prev}
|
{#if prev}
|
||||||
<button on:click={loadPrev}>
|
<button
|
||||||
|
on:click={loadPrev}
|
||||||
|
aria-label={$t("updates.button.previous", { value: prev })}
|
||||||
|
>
|
||||||
<IconArrowLeft />
|
<IconArrowLeft />
|
||||||
{prev || ""}
|
{prev || ""}
|
||||||
</button>
|
</button>
|
||||||
|
@ -124,6 +123,7 @@
|
||||||
on:click={loadNext}
|
on:click={loadNext}
|
||||||
on:focus={preloadNext}
|
on:focus={preloadNext}
|
||||||
on:mousemove={preloadNext}
|
on:mousemove={preloadNext}
|
||||||
|
aria-label={$t("updates.button.next", { value: next })}
|
||||||
>
|
>
|
||||||
{next || ""}
|
{next || ""}
|
||||||
<IconArrowRight />
|
<IconArrowRight />
|
||||||
|
@ -137,6 +137,7 @@
|
||||||
on:click={loadNext}
|
on:click={loadNext}
|
||||||
on:focus={preloadNext}
|
on:focus={preloadNext}
|
||||||
on:mousemove={preloadNext}
|
on:mousemove={preloadNext}
|
||||||
|
aria-label={$t("updates.button.next", { value: next })}
|
||||||
>
|
>
|
||||||
{next || ""}
|
{next || ""}
|
||||||
<IconArrowRight />
|
<IconArrowRight />
|
||||||
|
|
Loading…
Reference in a new issue