Let's create the Czech one, with code name cscz, which falls back to English. And another one that is, let's say German, which will again fall back to English. So, we can define where this should fall back to. It's gonna be English, the code name is gonna be deat. So, it's gonna be German for Austria. So, when you have these two languages added.
Oh, language limit reached to one language. That's fine, so just keep one extra there. Yeah, that's okay. It's a little bit for the free account, yes? But if you registered for the first time, you should get the full feature file at least for a month. So, but anyway, one language is fine for what you need. Yeah? When you add these two languages and go back into content, what you're gonna see here is the language dropdown that shows you the language variants that are available. And for, let's take a look at the homepage. When you open the content items and switch to another language, like Czech or German in this case, you're gonna see it's not translated. You can copy the content from another language, or you can start working on it from scratch. So, I'm just gonna copy it from English. But it's not as simple as that. So, you see, before I was talking about visual components. Right now when I created the homepage in a different language, it only creates the components in the different language, right? So, the linked content, like the conferences here, they are still not translated. And if you just say it like this, the item is going to look like it's not there because it's in a different language and you're asking for a check, but the checked version is not there. So, this is something you need to be careful about because this only, again, created the new components. We can, of course, change this. Let me just put some text here that probably nobody will understand. Yes, so I can change the text here, but when these items are not translated, I'm not gonna see them in this language variant. So, again, this can be translated. I'm just gonna put here, czop at the end so we don't have to spend some time on this, but we know exactly that it's translated. So let me publish this. And let's also translate some of the conferences. So we can again, copy from another language from English. Now here, what we can do is we can also change the URLs. So if you want to change, like in a different language, if you need to have different URLs, you can also do that here. So this is a react-advanced-mandarin. So let's put here czop at the end again. All right, well, let's publish this. And let's add another one, like from the three conferences, one at least, this one, for example. Right. And of course, you can play around with it any way you want here, or you can keep everything not translated, but you're not going to see any content then. So this is how we can create a new version, new language version of the content item. This is sometimes a bit of a different concept than what other renders have, but we actually treat the content item as a container and we always work with the language variants. So even when you're in a default language, what you're looking at is the language variants, not the content item itself, but its variant. Right, so this is the content part. So this is easy, just clicking through items and translating them. Now, when we go back into Next.js, you have pretty much two options here. Let me open the Next.js docs actually. On I18N. Oh, not the page that I was looking for. There's Redux middleware, no. Oh, this is the page, yeah. Or is it? Now let me check the links. I think I put it in the links. Yeah, here it is. So in the links is the last link in the file, yeah. Sometimes it's just easier to use Google to find things in docs. So you have actually two options. One option is to use the domains. So you have a different domain for every different language. So in my case, that will be example.com and example.cz. And then you can define the default local for each of those domains, which is not really convenient when you're using local host, right? So we're actually going to do this instead, where we are actually going to default to have the locale as the first folder of the URL structure. So let me just switch back to next config. And because we're using TypeScript, the config looks a bit differently than what the documentation suggests, but just gonna put the I18N, Internationalization, Object, and things locales, yeah, locales and we have ENUS, Cs, Cz, and I also have DEAT, I think. The important thing is that these locales should correspond to the code names of the languages as you define them in content. It doesn't have to, but it just makes your life much easier if they do, yeah. So I have ENUS, Cs, Cz, DEAT under locales in I18N and then you need to define one default locale, which, in my case, is ENUS, so I can remove it from here. This is always going to be the local used for the root of your website. So the URLs that read example.com slash conference slash Jamstack Confer, React advanced, those are the ones in default locale. If you want, even the default locale, if you want that to be under slash EN-US slash conference and so on, there is a way to do that with the middleware, but it's not natively supported, so it's more of a work around, yeah. So this is the way Next.js actually wants us to use that. I'm actually fine with having the local for EN-US now. So I think that's all what we need to define here. Yeah, yeah, yeah.
Comments