Localizing Your Remix Website

Rate this content
Bookmark
Github

Localized content helps you connect with your audience in their preferred language. It not only helps you grow your business but helps your audience understand your offerings better. In this workshop, you will get an introduction to localization and will learn how to implement localization to your Contentful-powered Remix website.


Table of contents:

- Introduction to Localization

- Introduction to Contentful

- Localization in Contentful

- Introduction to Remix

- Setting up a new Remix project

- Rendering content on the website

- Implementing Localization in Remix Website

- Recap

- Next Steps

This workshop has been presented at React Summit 2023, check out the latest edition of this React Conference.

FAQ

The recipe web app allows users to access different recipes, switch languages to view content in their preferred language, and get detailed information about each recipe.

The language switcher in the web app enables users to change the language of the content. When a different language is selected, the app dynamically updates the names, values, and content to match the selected language.

The recipe web app is built using Node.js, React, and Remix. It also utilizes the Contentful platform for content management and GraphQL API for data fetching.

Internationalization is the process of designing and developing a product so that it can be easily localized for targeted audiences from different regions and languages. In the recipe web app, internationalization is implemented to prepare the app for easy localization of content.

Localization is adapting your product or content to meet the language, cultural, and other specific needs of a target market. It differs from internationalization, which is more about preparing the product at a structural level to support such adaptations easily.

Harshil Agrawal
Harshil Agrawal
154 min
16 May, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Workshop covered various topics such as introduction to localization and Remix, project setup, creating components, implementing content and internationalization, differences between Remix and Next.js, configuring internationalization, updating titles and navigation, introduction to Contentful, content model and localization, and dynamic routing. Key points include the importance of localization for target regions, the capabilities of Remix as a framework, the process of setting up a Remix project and configuring internationalization, the use of Contentful for managing content, and the implementation of dynamic routing in Remix.
Available in Español: Localizando tu sitio web de Remix

1. Introduction to Localization

Short description:

To give you all an idea of what we are going to build today, it's a very simple recipe web app. We're going to learn it from scratch. The prerequisites are Node.js, a good code editor, and a Contentful account. Basic knowledge of JavaScript and GraphQL is also important. Let's move forward and talk about localization. Localization is making your application available in different languages and ensuring it looks and feels appropriate for the target region. McDonald's in India is an example of successful localization, focusing on vegetarian options. Localization is more than just translation.

To give you all an idea of what we are going to build today, it's a very simple recipe web app. As you can see, right now I have just three different recipes. These are some of my favorite recipes. and there is a language switcher over here. I can switch the language and you can see it changes the name. It updates the values over here as well as for the content as well. I can open up that recipe and get that information as well. If I change it to English, it again translates or gives me the content localized in English again. So this is something that we are going to build and we're going to learn it from scratch as well.

To give you a quick introduction about myself, my name is Harshal Agrawal, and I work as a developer advocate at Contentful, which is something that we are going to look into more in detail. I love to experiment with various different technologies. In my recent experiment, I have been playing with the WebHID API. If you're not aware about the WebHID API, it's a fantastic API that allows you to connect your HID devices to your web applications. And one fun project that I've been working is connecting my PS5 controller with a web-based game. And if you want to know more about me, you can just hit me up. you can go to that website where you can find all the social links that I have and read more about me and my work as well.

All right. Coming back to this, the prerequisites are like, you need to have Node.js installed on your machine. You can use platforms like Gitpod or something, but I am going to be running it locally on my machine. So if you run into errors on those cloud platforms, I might not be able to help you thoroughly with that. So I hope you are using by running it locally on your machine and you have node.js installed. We need a good code editor because it makes the life easy. If you want to use, what was it called? Text, I don't know. The default code editor that window provides. If you want to use notepad, it's on new. Go ahead and use that. As I mentioned, we're going to use Contentful. So having an account on Contentful is going to be super useful. So if you don't have an account on Contentful, you can quickly go ahead and create one. Just go to contentful.com and create an account. You don't need a credit card. You can get started without the need of entering your credit card over there. And we have a basic knowledge of JavaScript and basic knowledge of React is also important. We are going to not use a lot of React over here because we are using Remix. which is super wonderful. But we are gonna use JavaScript a lot. And a basic idea of GraphQL would also be super useful because we are gonna use the GraphQL API over here.

All right. What I'm gonna do is I'm gonna take a couple of minutes over here, see if there are any questions till now around any prerequisites or any requirements or any of those things that I just talked about. If there are no questions, can just give me a thumbs up so that i know you are all clear till now and then and that i can move forward all right okay super so let's move forward and talk about localization as i mentioned i want this to be more interactive so i'm curious to know like what localization means to you again feel free to unmute yourself and just talk about what it means to you. Or if you want, if you prefer writing it in the chat, go ahead and write it in the chat. But I'm curious to know like what is localization for you. And over here, there are no wrong answers. So don't worry about, you know, worry about giving an answer which might not be correct. so localization is making your application available in different languages true true that's absolutely correct all right uh i'm gonna build on top of that and i'm gonna say it's it's also making sure that it's not just the language, but also the way your application looks and feels in that particular region, right? Some of the wonderful examples about localization that I can think about is brands like McDonald's. India is a country where the majority of the population is vegetarian. so if you think about mcdonald's they give out like burgers right and burgers mostly contain have those patties which is not vegetarian friendly so to make to be successful in india mcdonald's adopted uh adopted their strategy and uh and came out with options which focused heavily on vegetarian so all their patties were focused mainly on vegetarians and this is how is like this is like one of an example of localization so again to talk like give you a proper definition of localization it's basically an adaption of product application or document content to meet the language again not just the language but the but the cultural and other requirements of a specific target market right and it's not just about translation it's more than that We got Emanuel. I hope I'm pronouncing your name right, joining in. Hey, thanks for joining in. We've just started the workshop and we talked about what is localization.

2. Introduction to Localization and Remix

Short description:

If you're not on discord, I would highly encourage you to join the discord server. We've covered the prerequisites for the workshop. We discussed the difference between localization and internationalization. Internationalization is the process of making your apps ready for localization. From a project implementation point of view, both localization and internationalization are different processes. We then introduced Remix as the framework we'll be using. Remix is not just a React framework, it's a compiler, a server-side HTTP handler, a server framework, and a browser framework. It compiles your code, generates both server-side and client-side code, and allows you to create APIs. Remix has built-in wrappers for existing frameworks like Express, making it easy to deploy on any platform. It is also a server framework, meaning you can build your whole API using Remix. It's like the view and controller in the MVC framework.

If you're not on discord, I would highly encourage you to join the discord server. I've already shared my GitHub repo that we are going to go through this workshop And just a quick recap of the prerequisites, you need to have Node.js, install a code editor, some basic knowledge of JavaScript, React, and GraphQL would be super useful for you in this workshop.

All right, so we talked about localization. The next part I often hear folks when I talk about localization is this term called internationalization. And folks get confused when they talk about localization or internationalization they often times use these words in exchange of each other which is not like really true because while localization is adapting your product to a re to a particular region internet internationalization is the process of getting over there if we look at the definition of internationalization it's design and development of a product application or document content that enables easy localization for a targeted audience again this audience can vary in culture in region and language as well right so to summarize this internationalization is the process of uh internationalization is the process of implementing or making your apps ready for localization. Does that make sense, and does that clear out the difference between localization and internationalization? I see one thumb going up. Two thumbs going up. Okay, I feel like there might be a question in here. No, okay. All right, that's perfect. I'm gonna wait for one more minute because Fez is joining us as well. I just wanna make sure that before we move to the next part, he can hear what we covered and then we can just move real quick.

Can I ask a question meanwhile? Sure. From implementation-wise, of course, definition is different for localization and internationalization. From a project implementation point of view, how different they are in implementation? From a project implementation point of view, the way this works is you would again a lot of times people use these words in exchange of each other which is not true you always if you have looked into localization earlier you might have come across libraries like i18n but if you think about it it's it does not stand for localization it stands for internationalization right because that's the process of implementing localization So whenever you are working on a project, you, uh, enable it to be localized, even though you may, or may not be needing that in the future. So you are basically adopting the principles which are defined by intent, uh, by, for internationalization because that makes it easy to implement localization. Now, uh, the way I like to think about this is, and I think you'll get more idea about this when we start working on the application is, if I come back to the example over here. Now, I know that a certain part of my text is going to change in the application, right? I have already started working on implementing that part and I know, for example, welcome over here is different in German. The way I created this is keeping in mind that this particular word is going to change, but this whole particular message is going to change. Because I kind of already knew what things I want to do. Does that give you an idea? Does that answer your question? Yes. Yeah, it does. So can we say that internationalization is a subset of localization? I would not put it that way because for me, like, both are two different processes. because the way I think about it is like internationalization allows you to make your product ready for localization, right? Now, you might want to then localize that product for just one region, but you still have to go through the internationalization process and make sure that your product is ready to do that. Later on, you may decide you want to extend it to a new region, right? because you have implemented internationalization already, all you have to do is prepare that localized content, make that content available in that localized language and then simply publish that. So for me, it's kind of two different steps, two different processes, and it's not a subset of one another. Okay, makes sense. Thanks. All right. Faz, I think you just joined in. So we talked about localization. We talked about internationalization. And we are moving to the next part of the workshop. And I see you already are on the Discord servers. You already have the GitHub wrapper, which is fantastic. So moving forward, we are going to talk a bit about Remix because that's the framework that we are going to use today. now how many of you have write out image before or have heard about image before can i get a thumbs up or again feel free to unmute yourselves just write in the chat okay all right so i can say majority of you have heard about uh image but uh one person hasn't that's completely fine we're gonna look into it uh when i started exploring remix when i started playing around with remix i always thought that it was uh another meta framework which is built on top of react but while going through the documentation while working with remix i learned that it's not just another framework a react framework it's more than that so what exactly is remix well remix if you go to the documentation they define remix as a compiler a server site http handler a server framework and a browser framework so it's not just a react framework anymore but it's more than that because when they talk about remix being a compiler it actually compiles your code and gives you client client-side and server-side code. It also generates an asset manifestation file, which gives you a dependency graph and allows the code to map to the particular piece of code correctly. So it basically just compiles your code and gives you both server-side and client-side code. And I love this part about Remix that it's a server-side HTTP handler, which means that you can simply just use Remix as a server. You can just create APIs using Remix. You don't need to then use like any other framework for that. So because you make use is web, the web fetch API under the hood, which makes it easy to deploy on like any kind of platform really like if you are using, It does not matter if you're using Node.js or Deno. Under the hood, it allows you to do that. And the way Remix allows you to do that is it has built up wrappers around the existing frameworks like Express. It already has those wrappers built on top of those frameworks so now you don't have to worry about learning Express or learning about how Cloudflare workers work or how do you manage servers on Vielhel or Netlify and stuff like that. And it is also a server framework, which means as I already mentioned, you can build your whole API just using Remix. And you don't need to also provide any client output or you don't need to have a front end for that. Remix can handle the whole thing. So, the way I like to think about Remix over here is the view and the controller in the MVC framework.