-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
astro@2.4.4 broke collection content translation #34
Comments
You should be able to use |
Thanks a lot for the quick fix! I tried the following: export async function getStaticPaths() {
const articles = await getCollection("articles", ({ data }) => {
return data.lang === extractRouteLangCode(import.meta.url);
});
return articles.map((article) => ({
params: { slug: article.slug },
props: { article },
}));
} Logging |
My bad, it was an oversight. |
This time it should be fixed for real, here's how to do it : |
Thanks again! import { astroI18n, createStaticPaths } from "astro-i18n";
// Module '"astro-i18n"' has no exported member 'createStaticPaths'.ts(2305) I tried to look at your source code to avoid bothering you but I don't understand typescript really well, sorry. |
@narduin I just tried it in a new project and I don't have your error. |
It's working, I needed to restart vscode. |
Well, the markdown content is still broken but I think it might be astro's fault. I'll open an issue on the astro repo. |
weird, do you have a branch where I can test that on, I'm curious, maybe I can find a solution |
I've updated the reproduction branch where I implemented your fix here. |
Yes the frontmatter and i18n translations are working fine but not the markdown rendered content of the articles. EDIT: It's really weird. It seems only the content from the render function is bugging. When using |
That's weird, it looks like a problem at the astro level indeed because when logging the article it is translated. |
I made a builtin replacement https://github.com/Alexandre-Fernandez/astro-i18n#rendercontent. |
Hi!
Updating to astro@2.4.4 broke my collection translation logic, I could not find a workaround yet.
I suspect it has to do with this PR but I can't be certain…
Right now I have a content collection called 'articles' with two subfolders (
en
andfr
).Inside
src/pages/articles/[slug].astro
, I'm using the following logic to get the translated articles:What happens is the frontmatter translates correctly but the acutal content does not. When building the website, the same version of the content will be displayed on both languages instead of its translation.
Reverting back to astro@2.4.3 resolves everything 😅
I tested with
astro-i18n v1.7.0
andv1.6.1
andastro@2.4.5
as well.I have a branch available for reproduction.
The text was updated successfully, but these errors were encountered: