Skip to content

Not getting translation when base is not "/" #40

@AndresMpa

Description

@AndresMpa

Hey there, I'm trying i18n for my portafolio and I have a different base on my defineConfig so when I try to get deploy this on gh-pages I get no text or when I switch from "en" to "es" I get a 404 that redirect me to "/"

// astro.config.mjs
import { defineConfig } from "astro/config";
import liciousI18n from "@astrolicious/i18n";

export default defineConfig({
  integrations: [
    liciousI18n({
      defaultLocale: "en",
      locales: ["en", "es"],
      client: {
        data: true,
      },
    }),
  ],
  site: "https://andresmpa.github.io/",
  base: "/portafolio/",      /* <--- THIS */
});

If I make something like there's no any translation

// LocaleSwitcher.astro
  onchange="location = '/portafolio' + this.value;"

When base is "/" It works

export default defineConfig({
  /* */
  base: "/portafolio/",      /* <--- THIS */
});

Of course the switcher has to be something like this

// LocaleSwitcher.astro
  onchange="location = this.value;"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions