mirror of
https://github.com/BradNut/personal-website-sveltekit
synced 2025-09-08 23:20:18 +00:00
Adding more translations but will have a hard time with server rendered meta tags.
This commit is contained in:
parent
e63fdad9ce
commit
2183318644
11 changed files with 114 additions and 86 deletions
|
|
@ -3,6 +3,24 @@
|
||||||
"home_title": "Hello! I'm Bradley Shellnut.",
|
"home_title": "Hello! I'm Bradley Shellnut.",
|
||||||
"home_about": "I'm a full stack software engineer currently working on Java Spring, PostgreSQL, and React / Angular JS.",
|
"home_about": "I'm a full stack software engineer currently working on Java Spring, PostgreSQL, and React / Angular JS.",
|
||||||
"home_learning": "At home you can usually find me learning new things and working with SvelteKit, Next.js, and Gatsby.",
|
"home_learning": "At home you can usually find me learning new things and working with SvelteKit, Next.js, and Gatsby.",
|
||||||
|
"home_other_about_me": "Or you may find me jamming out to music 🎶, hiking ⛰️, making ",
|
||||||
|
"cocktails": "cocktails",
|
||||||
|
"home_fun_with_cats": " 🍸, or having fun with my cats. 🐈",
|
||||||
|
"home_check_me_out": "Check me out on",
|
||||||
|
"contact_through": "Contact through",
|
||||||
|
"read_more": "or read more",
|
||||||
|
"about_me": "about me",
|
||||||
|
"music_currently_listening": "Currently listening to",
|
||||||
|
"music_link_to": "Link to",
|
||||||
|
"music_by": "by",
|
||||||
|
"music_album_art_alt": "Album art for",
|
||||||
|
"articles_favorite_articles": "Favorite Articles",
|
||||||
|
"articles_favorite_tech_articles": "Favorite Tech Articles",
|
||||||
|
"articles_reading_time": "Reading time",
|
||||||
|
"articles_minute": "minute",
|
||||||
|
"articles_minutes": "minutes",
|
||||||
|
"articles_tags": "Tags",
|
||||||
|
"articles_more_articles": "more articles",
|
||||||
"nav_home": "Home",
|
"nav_home": "Home",
|
||||||
"nav_about": "About",
|
"nav_about": "About",
|
||||||
"nav_about_link": "about",
|
"nav_about_link": "about",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,24 @@
|
||||||
"home_title": "!Hola! Me llamo Bradley Shellnut.",
|
"home_title": "!Hola! Me llamo Bradley Shellnut.",
|
||||||
"home_about": "Soy un ingeniero de software de pila completa que actualmente trabaja en Java Spring, PostgreSQL y React / Angular JS.",
|
"home_about": "Soy un ingeniero de software de pila completa que actualmente trabaja en Java Spring, PostgreSQL y React / Angular JS.",
|
||||||
"home_learning": "En casa por lo general me puedes encontrar aprendiendo cosas nuevas y trabajando con SvelteKit, Next.js, y Gatsby.",
|
"home_learning": "En casa por lo general me puedes encontrar aprendiendo cosas nuevas y trabajando con SvelteKit, Next.js, y Gatsby.",
|
||||||
|
"home_other_about_me": "O puede que me encuentres improvisando música 🎶, haciendo senderismo ⛰️, haciendo ",
|
||||||
|
"cocktails": "cócteles",
|
||||||
|
"home_fun_with_cats": "🍸, o divertirme con mis gatos. 🐈",
|
||||||
|
"home_check_me_out": "Visítame en LinkedIn , Github , o lee más sobre mí",
|
||||||
|
"contact_through": "Contacto a través de",
|
||||||
|
"read_more": "o leer más",
|
||||||
|
"about_me": "sobre mí",
|
||||||
|
"music_currently_listening": "Actualmente escuchando",
|
||||||
|
"music_link_to": "Enlace",
|
||||||
|
"music_by": "por",
|
||||||
|
"music_album_art_alt": "Carátula del álbum de",
|
||||||
|
"articles_favorite_articles": "Artículos favoritos",
|
||||||
|
"articles_favorite_tech_articles": "Artículos tecnológicos favoritos",
|
||||||
|
"articles_reading_time": "Tiempo de lectura",
|
||||||
|
"articles_minute": "minuto",
|
||||||
|
"articles_minutes": "minutos",
|
||||||
|
"articles_tags": "Etiquetas",
|
||||||
|
"articles_more_articles": "más artículos",
|
||||||
"nav_home": "Inicio",
|
"nav_home": "Inicio",
|
||||||
"nav_about": "Acerca de",
|
"nav_about": "Acerca de",
|
||||||
"nav_about_link": "acerca-de",
|
"nav_about_link": "acerca-de",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { getTextDirection } from "$lib/i18n"
|
import { getTextDirection } from "$root/lib/i18n-routing"
|
||||||
import { sourceLanguageTag, type AvailableLanguageTag } from "$paraglide/runtime"
|
import { sourceLanguageTag, type AvailableLanguageTag } from "$paraglide/runtime"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
11
src/lib/I18NHeader.svelte
Normal file
11
src/lib/I18NHeader.svelte
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { availableLanguageTags } from "$paraglide/runtime";
|
||||||
|
import { page } from "$app/stores";
|
||||||
|
import { translatePath } from "$lib/i18n-routing";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
{#each availableLanguageTags as lang}
|
||||||
|
<link rel="alternate" hreflang={lang} href={translatePath($page.url.pathname, lang)} />
|
||||||
|
{/each}
|
||||||
|
</svelte:head>
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import * as m from "$paraglide/messages";
|
||||||
import type { Article } from "$lib/types/article";
|
import type { Article } from "$lib/types/article";
|
||||||
import ExternalLink from './ExternalLink.svelte';
|
import ExternalLink from './ExternalLink.svelte';
|
||||||
|
import { languageTag } from '$paraglide/runtime';
|
||||||
|
|
||||||
export let articles: Article[];
|
export let articles: Article[];
|
||||||
export let totalArticles: number;
|
export let totalArticles: number;
|
||||||
export let compact: boolean = false;
|
export let compact: boolean = false;
|
||||||
export let classes: string[] = [];
|
export let classes: string[] = [];
|
||||||
|
|
||||||
|
$: lang = languageTag();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2>Favorite Articles</h2>
|
<h2>{m.articles_favorite_articles()}</h2>
|
||||||
<div class={classes.join(' ')}>
|
<div class={classes.join(' ')}>
|
||||||
{#each articles as article (article.hashed_url)}
|
{#each articles as article (article.hashed_url)}
|
||||||
<article class='card'>
|
<article class='card'>
|
||||||
|
|
@ -29,9 +33,9 @@
|
||||||
</h3>
|
</h3>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<p>Reading time: {article.reading_time} minutes</p>
|
<p>{m.articles_reading_time()}: {article.reading_time} {article.reading_time === 1 ? m.articles_minute() : m.articles_minutes()}</p>
|
||||||
<div class="tagsStyles">
|
<div class="tagsStyles">
|
||||||
<p>Tags:</p>
|
<p>{m.articles_tags()}:</p>
|
||||||
{#each article.tags as tag}
|
{#each article.tags as tag}
|
||||||
<p>{tag}</p>
|
<p>{tag}</p>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
@ -41,8 +45,10 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="moreArticles">
|
<div class="moreArticles">
|
||||||
<a href="/articles">{`${totalArticles} more articles`}</a>
|
<a href={`${lang}/${m.nav_articles_link()}`}>
|
||||||
<a href="/articles" aria-label={`${totalArticles} more articles`}>
|
{`${totalArticles} ${m.articles_more_articles()}`}
|
||||||
|
</a>
|
||||||
|
<a href={`${lang}/${m.nav_articles_link()}`}>
|
||||||
<iconify-icon icon="material-symbols:arrow-right-alt-rounded"></iconify-icon>
|
<iconify-icon icon="material-symbols:arrow-right-alt-rounded"></iconify-icon>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Img from '@zerodevx/svelte-img';
|
import * as m from "$paraglide/messages";
|
||||||
import type { Album } from "$lib/types/album";
|
import type { Album } from "$lib/types/album";
|
||||||
import LazyImage from '../LazyImage.svelte';
|
import LazyImage from '../LazyImage.svelte';
|
||||||
|
|
||||||
|
|
||||||
export let albums: Album[];
|
export let albums: Album[];
|
||||||
const displayAlbums =
|
const displayAlbums =
|
||||||
albums?.length > 6 ? albums.slice(0, 6) : albums;
|
albums?.length > 6 ? albums.slice(0, 6) : albums;
|
||||||
|
|
@ -27,18 +26,18 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2>Currently listening to:</h2>
|
<h2>{m.music_currently_listening()}:</h2>
|
||||||
<div class="albumsStyles">
|
<div class="albumsStyles">
|
||||||
{#each displayAlbums as album}
|
{#each displayAlbums as album}
|
||||||
<div class="albumStyles">
|
<div class="albumStyles">
|
||||||
<figure>
|
<figure>
|
||||||
<a
|
<a
|
||||||
title={`Link to ${album.title} by ${album.artist}`}
|
title={`${m.music_link_to()} ${album.title} ${m.music_by()} ${album.artist}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={album.url}
|
href={album.url}
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
<LazyImage clazz="album-artwork" src={album.src} alt={`Album art for ${album.title}`} />
|
<LazyImage clazz="album-artwork" src={album.src} alt={`${m.music_album_art_alt()} ${album.title}`} />
|
||||||
</a>
|
</a>
|
||||||
</figure>
|
</figure>
|
||||||
<a
|
<a
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { translatePath } from '$lib/i18n';
|
import { translatePath } from '$root/lib/i18n-routing';
|
||||||
import { availableLanguageTags, languageTag } from '$paraglide/runtime';
|
import { availableLanguageTags, languageTag } from '$paraglide/runtime';
|
||||||
import * as m from "$paraglide/messages";
|
import * as m from "$paraglide/messages";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export function translatePath(path: string, lang: AvailableLanguageTag) {
|
||||||
*/
|
*/
|
||||||
function getPathWithoutLang(path: string) {
|
function getPathWithoutLang(path: string) {
|
||||||
const [_, maybeLang, ...rest] = path.split("/")
|
const [_, maybeLang, ...rest] = path.split("/")
|
||||||
if (availableLanguageTags.includes(maybeLang as any)) {
|
if (availableLanguageTags.includes(maybeLang as AvailableLanguageTag)) {
|
||||||
return `/${rest.join("/")}`;
|
return `/${rest.join("/")}`;
|
||||||
} else {
|
} else {
|
||||||
return path;
|
return path;
|
||||||
|
|
@ -7,11 +7,12 @@
|
||||||
import { PUBLIC_SITE_URL } from '$env/static/public';
|
import { PUBLIC_SITE_URL } from '$env/static/public';
|
||||||
import "nprogress/nprogress.css";
|
import "nprogress/nprogress.css";
|
||||||
import '$root/styles/styles.pcss';
|
import '$root/styles/styles.pcss';
|
||||||
import { setLanguageTag, sourceLanguageTag, type AvailableLanguageTag, availableLanguageTags } from "$paraglide/runtime";
|
import { setLanguageTag, sourceLanguageTag, type AvailableLanguageTag } from "$paraglide/runtime";
|
||||||
import Header from '$lib/components/header/index.svelte';
|
import Header from '$lib/components/header/index.svelte';
|
||||||
import Footer from '$lib/components/footer/index.svelte';
|
import Footer from '$lib/components/footer/index.svelte';
|
||||||
import Analytics from '$lib/components/analytics/index.svelte';
|
import Analytics from '$lib/components/analytics/index.svelte';
|
||||||
import { getTextDirection, translatePath } from '$lib/i18n';
|
import { getTextDirection } from '$root/lib/i18n-routing';
|
||||||
|
import I18NHeader from '$root/lib/I18NHeader.svelte';
|
||||||
|
|
||||||
NProgress.configure({
|
NProgress.configure({
|
||||||
// Full list: https://github.com/rstacruz/nprogress#configuration
|
// Full list: https://github.com/rstacruz/nprogress#configuration
|
||||||
|
|
@ -67,11 +68,7 @@
|
||||||
|
|
||||||
<MetaTags {...metaTags} />
|
<MetaTags {...metaTags} />
|
||||||
|
|
||||||
<svelte:head>
|
<I18NHeader />
|
||||||
{#each availableLanguageTags as lang}
|
|
||||||
<link rel="alternate" hreflang={lang} href={translatePath($page.url.pathname, lang)} />
|
|
||||||
{/each}
|
|
||||||
</svelte:head>
|
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{#key lang}
|
{#key lang}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
import Articles from '$lib/components/Articles.svelte';
|
import Articles from '$lib/components/Articles.svelte';
|
||||||
import type { Album } from '$lib/types/album';
|
import type { Album } from '$lib/types/album';
|
||||||
import type { Article, ArticlePageLoad } from '$lib/types/article';
|
import type { Article, ArticlePageLoad } from '$lib/types/article';
|
||||||
|
import { languageTag } from '$paraglide/runtime';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
let albums: Album[];
|
let albums: Album[];
|
||||||
|
|
@ -13,6 +14,7 @@
|
||||||
let totalArticles: number;
|
let totalArticles: number;
|
||||||
$: ({ albums, articlesData } = data);
|
$: ({ albums, articlesData } = data);
|
||||||
$: ({ articles, totalArticles } = articlesData);
|
$: ({ articles, totalArticles } = articlesData);
|
||||||
|
$: lang = languageTag();
|
||||||
|
|
||||||
const userNames = {
|
const userNames = {
|
||||||
github: 'BradNut',
|
github: 'BradNut',
|
||||||
|
|
@ -25,44 +27,47 @@
|
||||||
<div>
|
<div>
|
||||||
<h1>{m.home_title()}</h1>
|
<h1>{m.home_title()}</h1>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{m.home_about()}
|
{m.home_about()}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{m.home_learning()}
|
{m.home_learning()}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Or you may find me jamming out to music 🎶, hiking ⛰️, making{' '}
|
{m.home_other_about_me()}{' '}
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://kindredcocktails.com"
|
href="https://kindredcocktails.com"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
cocktails
|
{m.cocktails()}
|
||||||
</a>
|
</a>
|
||||||
🍸, or having fun with my cats. 🐈
|
{m.home_fun_with_cats()}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Check me out on
|
{m.home_check_me_out()}
|
||||||
<a
|
<a
|
||||||
href={`https://www.linkedin.com/in/${userNames.linkedIn}`}
|
href={`https://www.linkedin.com/in/${userNames.linkedIn}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Contact through LinkedIn"
|
aria-label={`${m.contact_through()} LinkedIn`}
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
LinkedIn
|
LinkedIn
|
||||||
</a>
|
</a>
|
||||||
,
|
,
|
||||||
<a
|
<a
|
||||||
href={`https://www.github.com/${userNames.github}`}
|
href={`https://www.github.com/${userNames.github}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
aria-label="Contact through Github"
|
aria-label={`${m.contact_through()} Github`}
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
Github
|
Github
|
||||||
</a>
|
</a>
|
||||||
, or read more <a href="/about">about me</a>.
|
, {m.read_more()}
|
||||||
</p>
|
<a href={`/${lang}/${m.nav_about_link()}`}>
|
||||||
|
{m.about_me()}
|
||||||
|
</a>.
|
||||||
|
</p>
|
||||||
<div class="social-info">
|
<div class="social-info">
|
||||||
<Bandcamp {albums} />
|
<Bandcamp {albums} />
|
||||||
<Articles {articles} {totalArticles} compact />
|
<Articles {articles} {totalArticles} compact />
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Pagination from "$lib/components/pagination/index.svelte";
|
import Pagination from "$lib/components/pagination/index.svelte";
|
||||||
|
import * as m from "$paraglide/messages";
|
||||||
import type { Article } from "$lib/types/article";
|
import type { Article } from "$lib/types/article";
|
||||||
import Articles from "$lib/components/Articles.svelte";
|
import Articles from "$lib/components/Articles.svelte";
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
@ -15,7 +16,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="pageStyles">
|
<div class="pageStyles">
|
||||||
<h1 style="margin-bottom: 2rem">Favorite Tech Articles</h1>
|
<h1 style="margin-bottom: 2rem">{m.articles_favorite_tech_articles()}</h1>
|
||||||
<Pagination
|
<Pagination
|
||||||
additionalClasses="top-pagination"
|
additionalClasses="top-pagination"
|
||||||
pageSize={limit}
|
pageSize={limit}
|
||||||
|
|
@ -25,33 +26,6 @@
|
||||||
base="/articles"
|
base="/articles"
|
||||||
/>
|
/>
|
||||||
<Articles {articles} {totalArticles} classes={['columns']} />
|
<Articles {articles} {totalArticles} classes={['columns']} />
|
||||||
<!-- <div class="articlesStyles">
|
|
||||||
{#each articles as article (article.hashed_url)}
|
|
||||||
<div class="articleStyles card">
|
|
||||||
<section>
|
|
||||||
<h3>
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
aria-label={`Link to ${article.title}`}
|
|
||||||
href={article.url.toString()}
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
{article.title}
|
|
||||||
</a>
|
|
||||||
</h3>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<p>Reading time: {article.reading_time} minutes</p>
|
|
||||||
<div class="tagStyles">
|
|
||||||
<p>Tags:</p>
|
|
||||||
{#each article.tags as tag}
|
|
||||||
<p>{tag}</p>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div> -->
|
|
||||||
<Pagination
|
<Pagination
|
||||||
additionalClasses="bottom-pagination"
|
additionalClasses="bottom-pagination"
|
||||||
pageSize={limit}
|
pageSize={limit}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue