Skip to content

getLocale() broken with strategy: "prefix" #35

@DavithkbY

Description

@DavithkbY

The getLocale() is broken on the index.astro when using strategy: "prefix",

Astro config:

import { defineConfig } from "astro/config";

import liciousI18n from "@astrolicious/i18n";

// https://astro.build/config
export default defineConfig({
  integrations: [
    liciousI18n({
      defaultLocale: "en",
      strategy: "prefix",
      locales: ["en", "nl", "fr"], // must include the default locale
    }),
  ],
});

routes/index.astro :

---
import { getLocale } from "i18n:astro";

const locale = getLocale()
---

{locale}

result when navigation to /nl :

image

as you can see it's showing the locale as 'en' in the frontend, but it should be 'nl'.

when using strategy: "prefixExceptDefault" it does work as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions