Removing the Default Locale | Internationalization in NextJs 14

preview_player
Показать описание
In this video, we'll complete our internationalization (i18n) implementation in NextJs 14 by updating our middleware to remove the default locale from the URL when using our default language. We'll also update our links and locale switcher to reflect this change.

👉🏼 The Ultimate NextJs 14 Course

👉🏼 Project source code (checkout `remove-default-locale` branch)

Chapters:
0:00 Intro
0:58 Project setup
4:25 Updating the middleware
6:56 Updating links
12:55 Updating locale switcher
17:20 Recap
Рекомендации по теме
Комментарии
Автор

Thank you so much! You saved me after hours and hours of googling <3 You are awesome!

EA-nrhc
Автор

Thank you so much. i had searched so much this subject. but i didn't find anthing. finally i made it thanks <3

kursatpolatci
Автор

Hi Hamed, thank you very much !!! You helped me a lot today !!! A spent few hours to understood this part of next and this video save me lot of time !! thx !!

SoufianeElkarnoubi
Автор

Everything is just PERFECT, I’ve found the best channel on NextJs tutorial I guess :). Just a feedback, in case you might want, try to talk a little fast. Just a little, somewhere around 1.15 - 1.25x

heysahilsingh
Автор

Thank Hamed for this useful video! Just in time)

alexeysmirnov
Автор

Awesome content as always. Would also love!! a video on this topic but using a cookie-based strategy instead. To opt-out of the route-based solution.

Sorkstryparen
Автор

Hi Hamed, I am continuously watching your vidoes, all of the things are very useful in my projects, Can you plz make the video about socket and it's connections
in next js

udhay
Автор

Wonderful. This video is gold. You are the only one talking about this topic. Do you think that is good idea, check the language saved in the user DB to set the locale in middleware? Some like: "const locale = user?.language ?? getLocale(request);"

andresgiovannicanasrodrigu
Автор

Hi Hamed. You saved our lives! I would like to ask you what if I don not want to support /en/something but only /something and /de/something, and in case of /en/something I should redirect to /something. What would be the suggested way and to be aligned with SEO standrds in order not to have errors in Google Search Console?

averelgr
Автор

Hi Hamed! What about url translation? That's really important speaking about SEO! You never mentioned it!

KaMZaTa
Автор

Hi Hamed, I followed your tutorial and i'm glad I figured out all the server and client components issue that has been bugging me for hours. The problem I have now is how do we persists this language preference of the user? I know about cookies and Docs mentioned NEXT_LOCALE cookie but I'm not quite sure what it wants or does. Does Next automatically handle the persistence of the preference with the middleware we setup?

amxwarestudios
Автор

Love the explanation! ❤ Definitely a sub from me.
Quick question. Removing the default default locale is good for seo purposes? If a website already has seo, and wants to migrate to nextjs with internationalization?

iantolmay
Автор

Hi Mr. Hamed,

Your tutorial on using Next.js for a multi-language website has been a real lifesaver for me. I've learned a lot about using next-intl for fixed content, but I've run into a challenge with dynamic content like user-created posts and comments. I'm not sure how to add them to the locales JSON files, and I've had trouble finding helpful resources on this topic.

I would be really grateful if you could point me in the right direction and maybe even consider creating a tutorial on handling dynamic content within the locales JSON files. Your help would mean a lot to me and others facing similar challenges.

Thank you so much,

arvin
Автор

Hi Hamed, this is great work really. However, I seem to be running into an issue with locale-switcher. Say, in my i18n.config I have defaultLocale: 'de' and locales: ['en', 'de']. When the browser language is 'de' everything works. However, if the browser language is 'en', then localhost:3000 is redirected to localhost:3000/en. At this point a user attempting to switch the language via the button 'de' breaks the code. Am I missing something here?

sonakissonaki
Автор

hi sir thank you
i want to use. fa and en
and fa as default but i think code will be read by default AcceptLanguage
i cannot set to fa(farsi) as default

msarlak
Автор

Thank you for the video. I have a question, how would you implement internationalization and localization (multi-region and multi-translation site) in Nextjs 14, like /[lang]/[region], with removing the default locale and region.
Is it possible?

mother_chucker
Автор

Now we have /about and /en/about? Two urls for the same site? Is that correct for SEO?

jarekch.
Автор

Sorry if this question has already been asked, but how do I translate a component that has some hooks (therefore client components) on it once the hooks cannot be called in async functions?

liviabellomi
Автор

This video was quite informative.. but bro.. please upload your next video on translating the not-found page efficiently

fakhrulislamfuad
Автор

Just wondering how we could generate static route for ‘/‘ and other routes that will be rewritten with the default lang?

For now I’m assuming that the main entry ‘/‘ will be always dynamic?

spmdev