| [ Web Proxy ] |
| Viewing: https://shopify.dev/docs/apps/build/localize-your-app#example-prompt | [Back] [Original] |
Shopify helps merchants expand their business to a global audience, sell to multiple countries, and scale internationally. This means that many merchants need to sell in multiple languages and currencies.
This guide explains how internationalization works, and provides key terms and example use cases for internationalization.
You'll also learn how to begin internationalizing your app by externalizing, formatting, and translating strings.
Shopifys priority European markets are growing rapidlyat nearly 3x the rate of the US. Yet only 57% of all public apps are available in these priority markets. Merchants typically experience Shopify as a combination of Shopify itself and apps: 82% of active merchants have at least one app installed, and virtually all merchants with sales use apps. This gap between international merchant adoption and localized app availability represents a significant opportunity for developers who localize their apps.
Additionally, different markets have unique needs, presenting specific opportunities for app developers:
European markets:
Japan:
Cross-market:
Internationalization can deliver measurable benefits for your app:
Without localized apps, international merchants face several challenges:
Internationalization helps merchants expand their business to a global audience by creating shopping experiences in local languages and currencies.
You can speed up internationalizing new and existing apps by using i18n-ally, an open source Visual Studio Code extension that makes it easier to externalize strings, view and navigate to translation strings from code, and perform machine translation.
You can speed up internationalizing new and existing apps by using i18n-ally, an open source Visual Studio Code extension that makes it easier to externalize strings, view and navigate to translation strings from code, and perform machine translation.
The following diagram illustrates the different stages in the process of internationalizing your app:
[Stages in the process of internationalizing your app]The following definitions provide a starting point for understanding key terms associated with internationalizing your app:
| Term | Definition |
|---|---|
| Internationalization | Building your app and interface so it can be used in different locales. This includes creating flexible interfaces that allow for text expansion and changes to word order. |
| Localization | Adapting your app and interface for different locales to make them a good cultural fit. This includes adapting features, changing visuals, and translating text. |
| Translation | Converting text from one language to another. Not to be confused with localization, translation is just one part of localizing a product. |
In this guide, you'll learn how to do the following tasks:
Translation is foundational to localization. The first step of translation involves externalizing any hard-coded strings from your app into translation files.
When your app renders its UI, it looks up the corresponding strings from the translation file that's associated with the requested locale.
The following example shows a hard-coded greeting string from an app:
The following example shows how to externalize the hard-coded greeting string in a translation file:
Even if you don't intend to initially translate your app, you should still externalize strings in your app during initial development. It can be difficult to externalize strings in an existing app that wasn't originally structured with externalized strings.
Even if you don't intend to initially translate your app, you should still externalize strings in your app during initial development. It can be difficult to externalize strings in an existing app that wasn't originally structured with externalized strings.
Text within graphics and images should also be externalized for translation.
Instead of having flat graphics that include text, externalize the text and overlay it on the graphic. Alternatively, you can generate flat graphics for each locale, and switch between them based on the requested locale.
Depending on the audience, the lookup of a translation string uses the preferred locale of either an app user or a buyer.
The mechanism for receiving the locale depends on the type of app or app extension being developed.
For example, apps rendered in the Shopify admin receive the app user's chosen locale in the locale request parameter in Shopify's GET requests to the app.
Refer to the documentation for your type of app extension for more information.
Beyond language translation, parts of your app's strings should adapt dynamically to different locales.
For example, dates and times, names, numbers, prices, and lists are elements that should be formatted differently based not on language, but on the user's region or preferences.
Remove these elements from your app's strings, use a localization library to generate the formatted versions, and inject the formatted versions dynamically using string interpolation. The following sections describe how to format the following parts of strings:
The format of dates and times varies by region, not by language. As a result, dates and times, such as the following examples, don't belong in translation strings:
| Locale | Formatted datetime |
|---|---|
en-US | 12/19/2020, 10:23 PM |
en-GB | 19/12/2020, 22:23 |
en-CA | 2020-12-19, 10:23 p.m. |
Use an API or library to format dates and times. For example, you can use Intl.DateTimeFormat and inject the formatted dates and times into your translations using string interpolation:
The format of numbers varies by region, not by language. As a result, numbers, such as the following examples, don't belong in translation strings:
| Locale | Formatted number |
|---|---|
en-US | 123,000 |
en-NL | 123.000 |
en-IN | 1,23,000 |
Use an API or library to format numbers. For example, you can use Intl.NumberFormat and inject the formatted numbers into your translations using string interpolation:
If the number is a variable, then you should also make use of pluralization features to make sure that the correct grammar can be used for each number.
If the number is a variable, then you should also make use of pluralization features to make sure that the correct grammar can be used for each number.
The format of prices varies by currency and region, not by language. As a result, prices, such as the following examples, don't belong in translation strings:
| Locale | Currency | Formatted price |
|---|---|---|
en-US | USD | $123,456.00 |
en-CH | USD | US$ 123456.00 |
en-IN | USD | $1,23,456.00 |
Use an API or library to format prices. For example, you can use Intl.NumberFormat and inject the formatted prices into your translations using string interpolation:
The way that items are combined into lists varies by region, not by language. As a result, lists, such as the following examples, don't belong in translation strings:
| Locale | Formatted list |
|---|---|
en-US | User, Product, or Variant |
en-GB | User, Product or Variant |
Use an API or library to format lists of items. For example, you can use Intl.ListFormat and inject the formatted lists into your translations using string interpolation:
The way that you address a person varies by context and region.
For example, for a person with the given name "Quinn" and surname "Ishida" might be addressed in the following ways:
| Locale | Formatted full name | Formatted casual name |
|---|---|---|
en-US | Quinn Ishida | Quinn |
en-JP | IshidaQuinn-sama | Ishida-sama |
Don't encode the name formatting conventions of North American English. Instead, use an API or library to format a person's name based on the context, and inject the formatted name into your translations using string interpolation:
LLMs can significantly streamline internationalization efforts by automatically handling many of the steps described above. Here's a sample prompt to help you get started:
Translating strings involves accounting for text expansion in different languages, and providing your source strings to someone that can translate the content.
When interfaces are localized, the content often expands in length. In most languages, text is up to 50% longer on average than English. Some non-Latin languages, such as Japanese, take up more vertical space. For character-based languages, text wrapping and line breaking cant always rely on spaces to separate words. Your interface needs to be flexible enough to accommodate language formatting and text expansion without changing its context of use.
The Polaris i18n documentation has more information about, and examples of, text expansion issues.
You can use pseudolocalization tools (example) to simulate text expansion before translation is completed. This enables you to test your app's UI for common text expansion issues. For example, you might want to test for overflowing strings or word wrapping.
The Shopify admin can be used in any of the supported languages.
Shopify also translates some buyer-facing strings (first-party themes, checkout, and system messages) into additional languages (for example, refer to the language list in the Dawn theme).
When deciding on which languages to translate into, consider starting with those most common in the regions or markets that your app supports.
Translating content involves providing your source strings to someone that can translate the content into each language.
Because you'll need to make changes to translations as you develop new features, you should expect the relationship with the provider of your translations to be a continuous partnership.
Because you'll need to make changes to translations as you develop new features, you should expect the relationship with the provider of your translations to be a continuous partnership.
There are several options for getting translations. The options vary on cost, turn-around time, and quality.
The highest quality, but often most costly, option is to engage a third party translation service to manage the work of providing translations for your app.
Translation providers manage the relationships with the translators so that you can have confidence in the quality and turnaround time of the translations.
Shopify recommends using one of the following translation providers:
Machine translation, such as Google Translate, is artificial intelligence software that can generate translations on-demand.
Machine translation can be quick and cost-effective, but the quality of the translations can vary because strings are often translated without context about your app or business.
If your app already has a large community, then sometimes community members are willing to contribute translations.
This method relies on managing and engaging your app's community in an ongoing manner, which can be time-consuming. Depending on the diversity of your community, it might be difficult to find enough people with fluency in the languages that you're translating your content into.
If you or an acquaintance knows another language, then translations for that language can be manually provided.
| Web Proxy Viewer | New URL | Original Page |