Markdown Files and i18n
Unanswered
Bonga shad posted this in #help-forum
Bonga shadOP
Hello people, I have a little question. I'm creating a website where a write some guides and posts.
Is there any way to make the blog bilingual? Spanish and English.
I mean, as the website as the posts and guides, because those are just mdx files (I don't care if I have to write the same file twice).
Is there any way to make the blog bilingual? Spanish and English.
I mean, as the website as the posts and guides, because those are just mdx files (I don't care if I have to write the same file twice).
22 Replies
@Bonga shad Hello people, I have a little question. I'm creating a website where a write some guides and posts.
Is there any way to make the blog bilingual? Spanish and English.
I mean, as the website as the posts and guides, because those are just mdx files (I don't care if I have to write the same file twice).
yes, you can create multiple mdx files and load the correct one, based on the currently selected user language
Bonga shadOP
@B33fb0n3 And how can I do that? I'm using velite as a contentlayer alternative. What do you recommend me?
Basically works as the same way, but I don't know how to make a configuration or something about the mdx files
I have seen something like
/content/posts/post.es.mdx
/content/posts/post.en.mdx
I don't know if that's correct, but what should I do to make that?
/content/posts/post.es.mdx
/content/posts/post.en.mdx
I don't know if that's correct, but what should I do to make that?
@Bonga shad Basically works as the same way, but I don't know how to make a configuration or something about the mdx files
I'm using velite as a contentlayer alternativeI don't know much about velite, however you can create mutliple mdx files for each language one. Then get the current selected user language and pass it to the url that will load the post. For example:
<MdxLoader src={`${postSlug}-${userLocale}.mdx`} />Like that you dynamically load only the specific file and of course the correct on for the user
@Bonga shadsolved?
Bonga shadOP
@B33fb0n3 Sorry the delay! I didn't receive the notification.
I'll try it out, thanks for your time!
I'll try it out, thanks for your time!
Bonga shadOP
@B33fb0n3 Well I think in a couple of hours lol here in Argentina is 03:22 AM hahaha I'll get some sleep and I'll try it that later
@B33fb0n3 Would you like to see my project?
I can share you the link
@Bonga shad I can share you the link
Yea, share if it’s public
Bonga shadOP
@B33fb0n3 Sure, I'll leave you the link below
Is not finished, but it's what I got so far
Oh I thought you share the code 😂
Bonga shadOP
@B33fb0n3 Yeah you can go to the code, the github link is in the footer
Bonga shadOP
@B33fb0n3 Hey sorry the delay, I already added next-intl with i18n routing
I created a locale switcher component and I translated all of my page, just I have to see how to translate the mdx files