Localization effort: The Website

That would be ideal since having to mess with Astro and company just acts as a roadblock for non web devs.

2 Likes

glad you like the idea, with a quick search I found i18next JSON files - Weblate 5.5.4 documentation and GitHub - yassinedoghri/astro-i18next: An astro integration of i18next + some utility components to help you translate your astro websites!, I’m currently hacking on Community tracking but once I have finished I’ll look into getting this up

2 Likes
3 Likes

Amazing stuff, great to start somewhere. Just left my two cents. Though, I’m not the best for any kind of Astro review.

Please add me as a reviewer when you’re ready, I can do Astro review

4 Likes

12 posts were split to a new topic: Triage Permissions

I can handle the review. Am also well versed in Astro. And also yea for some reason you don’t have perms to add a reviewer. We’ll have to take a look at that.

2 Likes

Astro is quite comfy

2 Likes

A few hours ago I managed to create an incomplete Spanish version of the site but I ran into problems with my git setup. I can still provide the translations if someone can implement them.

Also, I think it would be a good idea to get them reviewed by another Spanish speaking person here such as @eri (if they are okey tho, I pinged them because I know they speak Spanish).

3 Likes

translations have moved into public/translations/{lang}/translations.json in my PR, it should be far easier to add new translations that way

2 Likes

I would love to review your translations and provide any suggestion or implement them in the website!

2 Likes

I’d be happy to review your translations, please feel free to request my review when your ready :slight_smile:

2 Likes

Thanks to @marshmallow we now have support for multiple languages. We have merged their PR. So translators feel free to get started on the translation efforts.

4 Likes

I have a local dev session going, with the site displaying on http://localhost:4321, but I am unsure how I view the site in a specific language.

1 Like

From the code I’ve read it should be by their identify for example http://localhost:4321/en/ for English.

1 Like

That’s what I’ve been trying based on this: feat: i18n by mrshmllow · Pull Request #3 · auxolotl/website · GitHub, but given that I keep getting 404’s I’m guessing some type of redirect is missing - perhaps specifically from the dev mode?

1 Like

I’m not well versed in Astro, we best consult @coded.

taking a look into how i18n works for astro. Gimme a few moments.

1 Like

Ok, I’ve done some digging @AngryAnt, there’s a couple of steps.

  1. In src/pages create a directory named the 2 letter code of the language (eg: french would be fr).
  2. Copy and paste the index.astro file into the directory (it can stay unmodified).
  3. In public/locales create a directory named the same 2 letter code as earlier.
  4. Copy public/locales/en/translations.json into the directory you just made.
  5. Add the language in src/i18n/ui.ts in the same way English is added.
  6. Do your translations.

There may be a way to do this with dynamic routing, but since Astro needs to build everything to static I’ll have to do some more research on that. This way is fine for now.

2 Likes

Excellent! I have it working. Notes for others:

  • Remember to prefix all the imports in index.astro now that you have copied the file up one level.
  • Modified ui.ts looks something like this:
import en from "../../public/locales/en/translations.json"
import dk from "../../public/locales/dk/translations.json"

export const languages = {
	en: 'English',
	dk: 'Danish'
};

export const defaultLang = 'en';

export const ui = {
	en,
	dk
} as const;

I take it that for the PR I’ll not commit the duplicate index.astro?

3 Likes