Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndresMpa opened this issue Nov 9, 2024 · 1 comment
Open

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

AndresMpa opened this issue Nov 9, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@AndresMpa
Copy link

AndresMpa commented Nov 9, 2024

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;"
@florian-lefebvre
Copy link
Member

Hey, thanks for reporting! I'm not 100% sure but it's very likely that base is not being take into account at all. Unfortunately, I'm not really available these days so it's unlikely to be fixed anytime soon. PRs welcome tho!

@florian-lefebvre florian-lefebvre added bug Something isn't working help wanted Extra attention is needed labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants