Localization for Real-World Use-Cases: Key Learnings from Onboarding Global Brands

Rate this content
Bookmark

i18n isn't easy, but with careful planning of your content model I'll show you how to structure the setup, authoring, and querying of localized content. Covering whole-or-part translated documents, the difference between market and language-specific content, ways to author that in a CMS like Sanity, and ways to query for it on frontends like Next.js and Remix.

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

FAQ

The speaker is Simeon Griggs, a Solution Engineer at Sanity.io.

Sanity.io is a platform for structured content that allows you to customize your CMS experience to meet your needs.

Sanity focuses on content as data, allowing for greater flexibility in presenting and internationalizing content. It is not just a CMS but a platform for structured content.

Sanity allows you to map over fields or documents to create language-specific versions. This flexibility lets you internationalize content in a way that makes sense for your specific needs.

A Swedish music streaming company uses Sanity to manage 22 languages and custom markets, allowing content editors to create market-specific content from a single document.

Treating content as data allows for more flexible and efficient content management, enabling features like content internationalization, custom validation rules, and dynamic content presentation.

The new version of Sanity Studio (Version 3) is a component that can be loaded into any React application, offering unprecedented flexibility for developers.

You can book a demo by scanning the QR code provided during the talk, or visit the Sanity booth at the event.

Various companies, including an internet-connected speaker company, a German fitness brand, and a Swedish music streaming company, use Sanity for their content management and localization needs.

Sanity allows multinational companies to manage multiple market-specific websites and languages from a single data set, improving efficiency and consistency in content management.

Simeon Griggs
Simeon Griggs
8 min
17 Jun, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

I'm going to talk about localisation in the real world and how Sanity, a platform for structured content, focuses on content as data and flexible internationalization. Sanity allows for multiple languages in different markets, providing customization options for content visibility based on location. The platform offers a flexible approach to content creation and customization, allowing organizations to internationalize their content based on their specific needs. With Sanity's query language and the brand new version of Sanity Studio, developers have more flexibility than ever before.

1. Introduction to Localisation

Short description:

I'm going to talk to you about localisation in the real world. I am from Sanity. Sanity is a platform for structured content. It means that you can customise your CMS experience to be anything you want to. We say that content is data. And what does that mean? Well, let's unpack that by saying what the opposite is. So you've built a website like this, I've built websites like this. And back in the day when I used to sling WordPress websites, you would have said, what is the content model of this page?

♪ React Jingle ♪ If at any point you find my talk boring, you might want to pull up your phone here and take a photo of that QR code. You can book yourself a demo, get a look at Sanity, get an understanding. Otherwise, you can have a listen to me over the next few minutes.

So good day everyone in the room and a big hello internet, to everybody on the live stream. My name is Simeon Griggs I'm a Solution Engineer at Sanity.io. And I come here today with two goals in mind.

Two, one, I'm going to talk to you about localisation. And I want to bring, because I know it's been a long day already, I am going to bring the energy of a thousand exploding suns to localisation, because I know it's a topic that just excites people. To no end, but two, I do have an ulterior motive, I am a narcissist and I am obsessed with conference speaker photos. And I'm really hoping that there's some photographers in the room. And I just want to make sure that I... ... ...leave with a bit of that thought leadership sort of style. So I'm hoping somebody captured that or maybe there's something a bit better.

Well, it looks like I'm doing an open mic night holding my mic today. I'm going to talk to you about localisation in the real world. I am from Sanity. Sanity is a content... It's not a content management system. It's a platform for structured content. It means that you can customise your CMS experience to be anything you want to, if you want to make a validation rule on a document that you need to solve the day's wordle in order to publish it, you can do that. You don't need to, but you can. And we say that content is data. And what does that mean? Well, let's unpack that by saying what the opposite is. Who listens to podcasts at 1.5 speed? Because I figured there's going to be enough of you that you're going to be able to hold up if I keep talking like this for the whole time.

So you've built a website like this, I've built websites like this. And back in the day when I used to sling WordPress websites, who used to build WordPress websites for a living? Yes, my people. And back in the day you would've looked at this and you would have said, what is the content model of this page? And you would've said, Simeon, the content model for that, sir, is a page. And you would have made a file called template-course.php and you would've made that as a page. And the lessons would have been child pages of that page.

2. Content as Data and Internationalization

Short description:

Sanity focuses on content as data and allows for flexible internationalization. Language data can be internationalized differently based on content. Sanity provides the flexibility to internationalize things as it makes sense to the content. You can set up languages in Sanity using JavaScript, mapping over fields or documents to create language-specific versions. This single source of truth can be spread to your Sanity schema, plugins, translations APIs and services, and your Next.js or Remix routes. As a solution engineer, I present Sanity to customers and showcase how our customers have done internationalization in our software using key value pairs.

But that's content as presentation. Sanity focuses on content as data. And if you're still doing WordPress, I don't know, they're all blocks or something now but it's not right. So let's look at this website again. This is made up of disparate pieces of content that are connected, but we don't have to focus on the presentation of it as a website. It just happens to be in a website. This is content. This is course data, presenter data, label data, lesson data, and most importantly of all for today's topic, this is language data. And language data is really important because that can be internationalized differently based on that content.

So let's consider our presenter model. I've got a name, a title, and a photo. Now, only two of those things are going to change if I need to internationalize this document. My name is always going to be the same. My photo is going to be the same. So if I have multiple language versions in that document, I'm going to make multiple language versions of that field. And so if I'm looking at a lesson, well, all of these are text, so it wouldn't make sense to have all of these be localized versions in this document, we might as well just make localized versions of that document, and this is the sort of flexibility that Sanity gives you, is that you get to internationalize things, how it makes sense to the content, not how it makes sense to us. We don't tell you how to do language internationalization, because to us, everything's data. Language is the data. This is how you set up languages in Sanity, because everything's JavaScript, so it makes sense to a developer, right? You just map over fields, or map over documents, and create language-specific versions of those. And then this one config file can spread to your Sanity schema, to your plugins, off to translations APIs and services, off to your Next.js, or Remix routes, and it all just comes from this single source of truth that you check into GitHub, you deploy into the Studio. And that's localization in the real world.

So as a solution engineer, a lot of my job is presenting Sanity to customers that we have, but the great thing about how flexible Sanity is as a content platform is that our customers tell us how they're doing things. And so a lot of the rest of the talk here is showing how our customers are showing how they have done internationalization in our software. The problem is, I can't tell you any of their names, so I have to just talk in weasel words, kind of. So this internet connected speaker company that uses Sanity, they do key value pairs. So if you've done localization, sanity, you've probably done this sort of thing already. This is looking at a Google Translate plugin that we have so you can type content in one language and have that automatically be translated into multiple other languages. And you can set up key value pairs. So usually you'd store that in JSON. You can give your content teams a content editable version of that.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Don't Solve Problems, Eliminate Them
React Advanced Conference 2021React Advanced Conference 2021
39 min
Don't Solve Problems, Eliminate Them
Top Content
Kent C. Dodds discusses the concept of problem elimination rather than just problem-solving. He introduces the idea of a problem tree and the importance of avoiding creating solutions prematurely. Kent uses examples like Tesla's electric engine and Remix framework to illustrate the benefits of problem elimination. He emphasizes the value of trade-offs and taking the easier path, as well as the need to constantly re-evaluate and change approaches to eliminate problems.
Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
Routing in React 18 and Beyond
React Summit 2022React Summit 2022
20 min
Routing in React 18 and Beyond
Top Content
Routing in React 18 brings a native app-like user experience and allows applications to transition between different environments. React Router and Next.js have different approaches to routing, with React Router using component-based routing and Next.js using file system-based routing. React server components provide the primitives to address the disadvantages of multipage applications while maintaining the same user experience. Improving navigation and routing in React involves including loading UI, pre-rendering parts of the screen, and using server components for more performant experiences. Next.js and Remix are moving towards a converging solution by combining component-based routing with file system routing.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
RemixConf EU discussed full stack components and their benefits, such as marrying the backend and UI in the same file. The talk demonstrated the implementation of a combo box with search functionality using Remix and the Downshift library. It also highlighted the ease of creating resource routes in Remix and the importance of code organization and maintainability in full stack components. The speaker expressed gratitude towards the audience and discussed the future of Remix, including its acquisition by Shopify and the potential for collaboration with Hydrogen.
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Today's Talk discusses the importance of managing technical debt through refactoring practices, prioritization, and planning. Successful refactoring requires establishing guidelines, maintaining an inventory, and implementing a process. Celebrating success and ensuring resilience are key to building a strong refactoring culture. Visibility, support, and transparent communication are crucial for addressing technical debt effectively. The team's responsibilities, operating style, and availability should be transparent to product managers.

Workshops on related topic

Remix Fundamentals
React Summit 2022React Summit 2022
136 min
Remix Fundamentals
Top Content
Featured WorkshopFree
Kent C. Dodds
Kent C. Dodds
Building modern web applications is riddled with complexity And that's only if you bother to deal with the problems
Tired of wiring up onSubmit to backend APIs and making sure your client-side cache stays up-to-date? Wouldn't it be cool to be able to use the global nature of CSS to your benefit, rather than find tools or conventions to avoid or work around it? And how would you like nested layouts with intelligent and performance optimized data management that just works™?
Remix solves some of these problems, and completely eliminates the rest. You don't even have to think about server cache management or global CSS namespace clashes. It's not that Remix has APIs to avoid these problems, they simply don't exist when you're using Remix. Oh, and you don't need that huge complex graphql client when you're using Remix. They've got you covered. Ready to build faster apps faster?
At the end of this workshop, you'll know how to:- Create Remix Routes- Style Remix applications- Load data in Remix loaders- Mutate data with forms and actions
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
Back to the Roots With Remix
React Summit 2023React Summit 2023
106 min
Back to the Roots With Remix
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
The modern web would be different without rich client-side applications supported by powerful frameworks: React, Angular, Vue, Lit, and many others. These frameworks rely on client-side JavaScript, which is their core. However, there are other approaches to rendering. One of them (quite old, by the way) is server-side rendering entirely without JavaScript. Let's find out if this is a good idea and how Remix can help us with it?
Prerequisites- Good understanding of JavaScript or TypeScript- It would help to have experience with React, Redux, Node.js and writing FrontEnd and BackEnd applications- Preinstall Node.js, npm- We prefer to use VSCode, but also cloud IDEs such as codesandbox (other IDEs are also ok)
How to Solve Real-World Problems with Remix
Remix Conf Europe 2022Remix Conf Europe 2022
195 min
How to Solve Real-World Problems with Remix
Featured Workshop
Michael Carter
Michael Carter
- Errors? How to render and log your server and client errorsa - When to return errors vs throwb - Setup logging service like Sentry, LogRocket, and Bugsnag- Forms? How to validate and handle multi-page formsa - Use zod to validate form data in your actionb - Step through multi-page forms without losing data- Stuck? How to patch bugs or missing features in Remix so you can move ona - Use patch-package to quickly fix your Remix installb - Show tool for managing multiple patches and cherry-pick open PRs- Users? How to handle multi-tenant apps with Prismaa - Determine tenant by host or by userb - Multiple database or single database/multiple schemasc - Ensures tenant data always separate from others
Build and Launch a personal blog using Remix and Vercel
Remix Conf Europe 2022Remix Conf Europe 2022
156 min
Build and Launch a personal blog using Remix and Vercel
Featured Workshop
Robert Pop
Robert Pop
In this workshop we will learn how to build a personal blog from scratch using Remix, TailwindCSS. The blog will be hosted on Vercel and all the content will be dynamically served from a separate GitHub repository. We will be using HTTP Caching for the blog posts.
What we want to achieve at the end of the workshop is to have a list of our blog posts displayed on the deployed version of the website, the ability to filter them and to read them individually.
Table of contents: - Setup a Remix Project with a predefined stack- Install additional dependencies- Read content from GiHub- Display Content from GitHub- Parse the content and load it within our app using mdx-bundler- Create separate blog post page to have them displayed standalone- Add filters on the initial list of blog posts
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.