Comments (11)
Same in my project. I fixed it by using
i18next.langauge
property in the second argument oflocalizePath()
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.
Same behaviour on my project, same context as mentioned above.
from astro-i18next.
🎉 This issue has been resolved in version 1.0.0-beta.19 🎉
The release is available on:
Your semantic-release bot 📦🚀
from astro-i18next.
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.
Same behavior on my project, same context as mentioned above.
from astro-i18next.
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.
@yassinedoghri I had to manually install it, after the update. It is installed, though.
from astro-i18next.
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.
@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.
I just noticed that it happens because of the i18next
version 23+
from astro-i18next.
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)
- Share styles between translated pages
- Disable 'missing translation key' for default locale when using text as keys
- interpolatedString seems undefined HOT 5
- translation.json not hot reloading. need to restart astro dev
- Support og:locale
- pnpm exec astro-i18next generate - removes comments
- i18next version 23.0.0 or higher includes breaking changes. HOT 13
- Does changing language make the public folder innacessible?
- Is the project still maintained? HOT 6
- TypeScript error "Could not find a declaration file for module" HOT 2
- An exception occurred when executing the command 'npx astro-i18next generate'
- After I ran the npx astro-i18next generate command, my .tsx file and .scss file are missing!
- error when using astro-i18next Trans component HOT 9
- Cannot read properties of undefined (reading 'map') in LanguageSelector component. HOT 1
- How to get current language in astro-i18next? HOT 2
- Is there any way to ignore specific page being generated?
- please support cloudflare HOT 2
- Noob question but, how to make this work with a collection? HOT 1
- Ignore 404.astro when run `npx astro-i18next generate` HOT 1
- Working with markdown pages (.md) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro-i18next.