So let's take a look at how it works in Remix. So in Remix case, there are in general two approaches to choose. So the first option would be using the package called Remix, IAT Next. And the second approach would be like using Content Management System.
So first of all, let's take a look at what is Remix IAT Next. So I told you before that it is an NPM package, right? And this is more precisely made for the Remix to use this internationalization framework called IAT Next. And that is built by Sergio. So thank you, Sergio, for building such an amazing NPM package because now, because of that, we have more options to choose.
Alright, so let's take a look at example from this case. And first of all, we are going to create a couple of configuration files. But to get started, we're going to create translated files. In this case, I'm going to create one default language and one another language. So I set English as a default language. So I created on the right hand side and on top, the file called common dot JSON file, I'm going to show you why I already know I can give a name to, you know, like the common dot JSON file in this case. But let's focus on for now how we can accept the property name and the key values, which is actually like localized on string values.
So first of all, I have decided to, let's say call this property name as greeting. So this value I'm going to use when I'm going to translate from the source code, you know level. So on the right hand side is the key value, which is localized string value. I want say hello in English and to translate into Japanese. In this case, I have created another translated file for, you know, like storing, you know, this Japanese translated file in, under the directory of JA. So the value will be hello in Japanese. So after creating these translated files, we are going to create i18next configuration file.
So, as I said before, for some reason I already knew that I was able to give the name of the translated files to be command.js, right? So here's the reason why. If you pay attention to this default, NS, by the way, NS stands for the namespaces, and I gave the name as command. So that's why I already knew that I could give a name as command.js. So there are a couple of other configurations, but nothing too complicated because first of all, I just want to list up the supported languages, English, Japanese, and of course, I want to have a fallback language to be the default language. Based on what we created to translate these files, and also the IAT Next translation, sorry, the configuration file, now is the time to import this IAT Next configuration file into the IAT Next.server.js file.
So after importing it, of course, I want to call couple of the values. First of all, the supported language list, and also the fallback language list. And based on that, remember, this, you know, like configuration file we created, these, you know, like languages list are the arrays inside of the arrays, and the values inside are strings.
Comments