From 91b632ac2d42a0d950d040877795fe72de05cbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sof=C3=ADa=20Aritz?= Date: Sun, 8 Jan 2023 21:19:30 +0100 Subject: [PATCH] Add initial support for post translation - The `Post` component now accepts the props `lang` and `langs` that indicate which languages are supported and which language is that post. - Posts now accept a `?lang` query param to ask for a specific lang - If only one lang is supported, a link is created to a LibreTranslate endpoint that contains the post. Translation right now is done just from Spanish to English (though the user can choose other languages in the LibreTranslate UI) - Added default notice for non-spanish posts about the fact that I'm not native and that grammar/wording issues can be reported on the Codeberg repo --- src/lib/posts/FirstPost.svelte | 22 +++++++++- src/lib/posts/Post.svelte | 78 ++++++++++++++++++++++++++++++---- 2 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/lib/posts/FirstPost.svelte b/src/lib/posts/FirstPost.svelte index 2e4d6dd..1fafd79 100644 --- a/src/lib/posts/FirstPost.svelte +++ b/src/lib/posts/FirstPost.svelte @@ -1,8 +1,10 @@ - + Primer post! 01 Enero 2023 | Sofía Aritz
@@ -20,3 +22,21 @@

+ + + First post! + 01 January 2023 | Sofía Aritz +
+

+ This is my first post! You can subscribe to the feed to be up-to-date with + whatever I add here :) +

+

+ The objective of this weblog is to talk about the things I find at the Internet and to talk about computer + stuff. Some post may be quite technical while others may be quite personal. +

+

+ With that being said, I wish everyone one a happy new year ;p +

+
+
diff --git a/src/lib/posts/Post.svelte b/src/lib/posts/Post.svelte index 68252b2..82198b9 100644 --- a/src/lib/posts/Post.svelte +++ b/src/lib/posts/Post.svelte @@ -1,9 +1,71 @@ -
-

Sin título

- Fecha desconocida | Autor desconocido - -
- Post vacío + + +{#if is_lang} +
+

Sin título

+ Fecha desconocida | Autor desconocido + {#if langs.length > 1} +
+ {#each langs as lang} + + {lang.toUpperCase()} + + {/each} +
+ {:else} +
+ + {langs[0].toUpperCase()} + + + LibreTranslate + +
+ {/if} +
+ +
+ Post vacío +
+
- -
+ {#if lang !== "es"} +
+ + + Note: I'm not native. If you find any weird grammar or any error, please + open an issue :) + + + {/if} +
+{/if} + +