Added en translations & language switcher
This commit is contained in:
parent
6dcf41567a
commit
0bd2e43d18
3 changed files with 106 additions and 2 deletions
25
src/components/LanguageSwitcher.astro
Normal file
25
src/components/LanguageSwitcher.astro
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
import { Icon } from "astro-icon/components";
|
||||
import { astroI18n, l } from "astro-i18n";
|
||||
|
||||
interface Languages {
|
||||
[U: string]: string
|
||||
}
|
||||
|
||||
const current = astroI18n.locale;
|
||||
const languages: Languages = {
|
||||
cs: "Čeština",
|
||||
en: "English"
|
||||
};
|
||||
const list = Object.keys(languages);
|
||||
|
||||
function isPrevLang(index: number) {
|
||||
return (index+1) % list.length == list.indexOf(current);
|
||||
}
|
||||
---
|
||||
|
||||
{ list.map((lang, i) =>
|
||||
|
||||
isPrevLang(i) && <a href={ l(Astro.url.pathname, undefined, {targetLocale: lang}) }>{ languages[lang] } <Icon name="tabler:world" /></a>
|
||||
|
||||
) }
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
import { Icon } from 'astro-icon/components';
|
||||
import NavLink from './NavLink.astro';
|
||||
import LanguageSwitcher from './LanguageSwitcher.astro';
|
||||
import "../styles/nav.css";
|
||||
import { t, l } from "astro-i18n";
|
||||
|
||||
|
@ -29,10 +30,13 @@ const nav = [
|
|||
</li>
|
||||
) }
|
||||
<li class="right">
|
||||
<a href="https://status.codespace.cz" target="_blank">{ t("nav.status") } <Icon name="tabler:external-link"></a>
|
||||
<a href="https://status.codespace.cz" target="_blank">{ t("nav.status") } <Icon name="tabler:external-link" /></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://wiki.codespace.cz" target="_blank">{ t("nav.wiki") } <Icon name="tabler:external-link"></a>
|
||||
<a href="https://wiki.codespace.cz" target="_blank">{ t("nav.wiki") } <Icon name="tabler:external-link" /></a>
|
||||
</li>
|
||||
<li>
|
||||
<LanguageSwitcher />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
75
src/i18n/common/en.json
Normal file
75
src/i18n/common/en.json
Normal file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"nav": {
|
||||
"home": "Home",
|
||||
"services": "Services",
|
||||
"contact": "Contact",
|
||||
"status": "Status",
|
||||
"wiki": "Wiki"
|
||||
},
|
||||
"home": {
|
||||
"meta": {
|
||||
"title": "CodeSpace.cz - freedom and independence in the digital age"
|
||||
},
|
||||
"header": {
|
||||
"title": "United by the desire for <span>freedom</span> and <span>independence</span> in the digital age.",
|
||||
"description": "We run our own network and servers so we don't have to rely on others. We provide various services that respect our privacy."
|
||||
},
|
||||
"services": {
|
||||
"title": "Services",
|
||||
"description": "Overview of the main services we operate.",
|
||||
"more": "The complete list of services can be found on the <a href=\"{# link #}\">services page</a>."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"title": "Services",
|
||||
"description": "Overview of all services we provide on our infrastructure.",
|
||||
"public": {
|
||||
"title": "Public services",
|
||||
"description": "Overview of all provided public services."
|
||||
},
|
||||
"for_members": {
|
||||
"title": "Services for members",
|
||||
"description": "We also provide other services that are primarily intended for our members"
|
||||
},
|
||||
"more": "We can also individually provide you with a wide range of <a href=\"{# link #}\" target=\"_blank\">other services</a>.",
|
||||
"labels": {
|
||||
"invite": "invite-only"
|
||||
},
|
||||
"piped": {
|
||||
"title": "Piped",
|
||||
"description": "An alternative YouTube frontend that doesn't track you and is ad-free."
|
||||
},
|
||||
"pipedmusic": {
|
||||
"title": "Piped Music",
|
||||
"description": "Our open-source music client that doesn't share your data with anyone."
|
||||
},
|
||||
"send": {
|
||||
"title": "Send",
|
||||
"description": "Send up to 10 GB of files securely and privately with end-to-end encryption."
|
||||
},
|
||||
"forgejo": {
|
||||
"title": "Forgejo",
|
||||
"description": "A simple and easy-to-use extension of Git, on which we develop our projects."
|
||||
},
|
||||
"vaultwarden": {
|
||||
"title": "Vaultwarden",
|
||||
"description": "Password manager with useful features compatible with Bitwarden."
|
||||
},
|
||||
"plausible": {
|
||||
"title": "Plausible",
|
||||
"description": "Website traffic statistics respecting the privacy of visitors."
|
||||
},
|
||||
"nextcloud": {
|
||||
"title": "Nextcloud",
|
||||
"description": "File storage with sync options and lots of useful apps."
|
||||
},
|
||||
"webhosting": {
|
||||
"title": "Webhosting",
|
||||
"description": "We offer web hosting services on our own platform."
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"title": "Contact",
|
||||
"description": "Ways you can contact us."
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue