This article is a translation. Original publication here.
In the United States, the Latinx community comprises a large part of the population. Therefore, many of Lyft’s drivers and riders speak Spanish. However, before 2018, these users could only access the app in English. This issue prompted several of our engineers in 2018 to engage in discussions with other companies to learn more about the solutions they used in making their respective applications available in multiple languages. After these conversations, we at Lyft decided to do things a little differently than other technology companies. This solution allowed us to have more than two languages available in the app. We decided to start with Spanish, since, after English, it is the most common language preferred by Lyft drivers based on their mobile device settings.
There are two types of platforms on which we store Lyft content for translation: client (in mobile apps) and on our servers. For both, a new type of data structure was created, the “translatable string,” which contains not only a string of characters but the context in which it will be used.
Here is a very simple example:
CONTEXT: car color dropdown option in Lyft’s online driver sign up process, e.g. “car color: red”
In this case, it would seem evident that we are looking to translate a single word, “red”, which alludes to the color of the car. It is not so complicated for the translator to understand, however, in more complex examples, the context will help him or her find the right translation for each situation.
For both the client and the server, there are several elements that we have to define before showing our system designs.
First, it’s important to note that we use a third-party translation management system (TMS) that handles the translations we send them.
Then, we created an internal microservice in Lyft called “translation service.” This service handles interactions between the third-party system and Lyft’s mobile services and apps that need to translate a string of characters. This service takes care of three things:
- Extracting character strings that need to be translated.
- Sending those strings to the TMS.
- Distributing the translations to the microservices or clients (mobile apps) that need them.
This is the overall solution we’ve implemented at Lyft. However, certain specific considerations will change depending on whether the translations are delivered to microservices or mobile (client) applications.
Translations in the app (client)
In mobile apps, there are a lot of strings, but the advantage is that a large part of them are constant. This makes the design of the mobile solution a little simpler. Here you can see the diagram that explains the design that’s used to translate the strings for the client apps:
Translations in the microservices (‘backend’)
In this case, many of the strings to be translated are dynamic because they may be stored in a database or in a configuration file on the servers. This makes the solution in this case a little more complex. Here, apart from the translation service and the TMS, there is also a configuration repository containing translations called “translationdata.” This data is downloaded to the servers of the services that subscribe to it by way of the configuration of the service that needs it. This design allows translations and changes to be made when the data changes dynamically. This can be seen in the following diagram:
Testing the app in Spanish
When we performed the first tests of our translation systems, we realized that some strings in Spanish did not fit within the available screen spaces for certain buttons, since this language tends to use more characters than English in order to express an idea. To fix this problem internally, Lyft created a way to control the language in the app’s alpha settings so that you can change the app’s language to check different strings and how they are displayed on the screen. In the following example, we can see the above with the screenshots I took from the alpha version app on my mobile phone.
When the first translations came out, many Spanish-speaking employees had the opportunity to test the Lyft apps in Spanish and see what errors were present in some of the translations which failed in the contextualization process, as well as make suggestions to correct them. For example, one of the errors I found the first time I used the app in Spanish was that on the promotions page, whereas in English it said “Free rides”, in Spanish it said, “Viajes libres” (free as in speech) instead of “Viajes gratis” (free as in products).
At Lyft, these changes were crucial to the services we offer. They could not have happened without the efforts of key team members such as Dan Sullivan, Julien Silland, Ava Zhang, Kris Gellci, Brian McConnell, Ryan Grasell, Zak Haitkin, Alex Atencio, Antonio Luna, Jonathan Schoonhoven, Rahul Phalak, Dan Barak, among others.
Lyft is hiring. If you want to be a part of our team, check out lyft.com/careers.
Original article by Miguel Molina. Translated to English by Zak Haitkin.