Code Monkey home page Code Monkey logo

Comments (11)

itsmatteomanf avatar itsmatteomanf commented on June 18, 2024 2

Same in my project. I fixed it by using i18next.langauge property in the second argument of localizePath() function, like so:

import i18next from "i18next";
import { localizePath } from "astro-i18next";

// ...

localizePath(link, i18next.language)

I knew it was possible to fix this @Akasiek, but I have tens and tens of instances scattered across tens of files.
Can I do it? Sure.
Do I want to manually inject all of this? Nope, but I soon will have to if we don't get a reply/fix.

from astro-i18next.

loadbrain avatar loadbrain commented on June 18, 2024 1

Same behaviour on my project, same context as mentioned above.

from astro-i18next.

github-actions avatar github-actions commented on June 18, 2024 1

🎉 This issue has been resolved in version 1.0.0-beta.19 🎉

The release is available on:

Your semantic-release bot 📦🚀

from astro-i18next.

Akasiek avatar Akasiek commented on June 18, 2024

Same in my project. I fixed it by using i18next.langauge property in the second argument of localizePath() function, like so:

import i18next from "i18next";
import { localizePath } from "astro-i18next";

// ...

localizePath(link, i18next.language)

from astro-i18next.

ferrarafer avatar ferrarafer commented on June 18, 2024

Same behavior on my project, same context as mentioned above.

from astro-i18next.

yassinedoghri avatar yassinedoghri commented on June 18, 2024

I'm guessing it's because I've set i18next as a peer dependency in beta.18. I'll look into it.

from astro-i18next.

itsmatteomanf avatar itsmatteomanf commented on June 18, 2024

@yassinedoghri I had to manually install it, after the update. It is installed, though.

from astro-i18next.

yassinedoghri avatar yassinedoghri commented on June 18, 2024

Reverted to having i18next packaged with astro-i18next to have this fixed. Apparently the i18next instance is not shared with astro-i18next otherwise, thus the undefined.

from astro-i18next.

theprobugmaker avatar theprobugmaker commented on June 18, 2024

@yassinedoghri For some reason I'm still getting this problem:

[...page].astro:

---
import i18next, { changeLanguage } from "i18next";
import { localizePath } from "astro-i18next";
import { getCollection } from "astro:content";
import Layout from "../../layouts/Layout.astro";

export async function getStaticPaths({ paginate }) {
  changeLanguage("en");

  const posts = await getCollection("blog", ({ id }) =>
    id.startsWith(i18next.language)
  );

  return paginate(posts, {
    pageSize: 1,
  });
}

const { page } = Astro.props;

const example = localizePath(`blog/${page.data[0].slug.split("/").slice(1).join("/")}`)

console.log(example);
---

WARNING(astro-i18next): "undefined" locale is not supported, add it to the locales in your astro config.

  "dependencies": {
    "@astrojs/mdx": "^1.0.0",
    "astro": "^3.0.7",
    "astro-i18next": "1.0.0-beta.21",
    "i18next": "^23.4.6",
    "i18next-fs-backend": "^2.1.5"
  }

from astro-i18next.

theprobugmaker avatar theprobugmaker commented on June 18, 2024

I just noticed that it happens because of the i18next version 23+

from astro-i18next.

amosbastian avatar amosbastian commented on June 18, 2024

I am getting this issue too

"astro-i18next": "1.0.0-beta.21",
"i18next": "^23.7.11",
"i18next-fs-backend": "^2.3.1",
"i18next-http-backend": "^2.4.2",

from astro-i18next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.