Also, he wants to know about how to localize the URLs. So, let me be clear what we want to achieve for the rest of my talk. So, we want to achieve actually localized URL. And also, we do not want to have translation files in our code.
So, here's another example, you know, based on what we saw, Remix in general, can have two approaches to implement internationalization. First of all, we took a look at together to use this NPM package called Remix I18next and secondly, we're going to take a look at the content management system example. So, you can choose whatever kind of content management system or headless CMS is out there.
In this talk, I picked up Storyblock because it's the most, I would say, comfortable and familiar CMS for me. I use it the most. And also, it gives the most numbers of, let's say, structures to configure how you want to localize the content on the CMS side. But I'm not going to talk about how you can implement between Storyblock and Remix. This can be explained in this tutorial, let's say, blog post so you can easily take a look at it after my talk.
All right. Depending on the headless CMSs or the CMSs of your choice, it would give you one to four ways to structure to store localized content. And as part of it, it also will give you some possibilities, or not just you, for your translators and content editors to structure how they want to nest these dynamic routes. I wish I could have more time to explain and show you all these four approaches, but for time-conscious, I'm going to show you this folder-level translation.
This approach is quite straightforward because, as you can see, all localized content are being stored in the dedicated folders. So, there's no way that the translators will mix up localized pages and the content. First of all, before going to take a look at more in depth how it works with the source code level, I'm going to show you how it works on the browser.
So, here I'm at the default, let's say, blog overview page, which is in English, and of course if I'm going to take a look at the traveling to Salt Lake City, all these English blog posts for relevant pages are being stored at the folder. Let's say URL shouldn't include any slugs because this is the default language, right? But if I go to this exactly the same page, traveling to Salt Lake City in Japanese, it should include JA which stands for the Japanese slug, and also the contents are being translated on the right-hand side. You can see the your translators can work on to store the translated values of the content, and if I go back to the previous page, which is the blog overview page, it also includes JA in the URL, and if I go back to the default home page, which is in the most root, it shouldn't include any, let's say, even EN, of the language slug. And of course, the contents are being back to the English.
So in this way, you can see that you do not have to deal with translated files anymore in your source code. Instead, the translators who should be actually the one being responsible to start to translate the content and managing the content where it should be stored can have all the, let's say, flexibility. And here's the little logic, how you can actually create such kind of dynamic route logic in there. So in Remix, there are a couple of ways to, let's say, render these kinds of dynamic routes. But I picked up this flat route, because by using it, you will allow whoever wants to create the pages and even create nested dynamic routes from the content management system, they can do that without editing any source code. So once you implement this feature by using these flat routes, then dynamic routes, even including the nested structure, can be done from the CMS side. So here's the little kind of example.
Comments