Skip to main content
Version: 5.x

Localization

Localizations Assets allow you to localize text in your Lens so that it can be used by Snapchatters all around the world! The Lens will automatically use the correct localized string provided by a Localizations Asset based on the Snapchatter's device language.

In order to use this feature, you will need to provide your own text localization. Check out the Localization Template which provides several examples of commonly localized text.

Localizations Asset

The Localizations Asset is a resource in your Lens Studio project that provides the necessary localized text for your Lens. The asset refers to a folder containing files for each language that you’ve translated your texts to.

Unlike other assets, Localizations Asset does not need to be added into a Component. It simply needs to be in the Asset Browser panel of your current project.

Creating a folder of translations

The process of creating a folder to be imported as Localizations Asset happens outside of Lens Studio. You can use any text editor to create the required files. However, they should follow the following guidelines to be recognized by Lens Studio.

Each file name should be formatted as such: strings_[Locale Code].json,

where the Locale Code represents the content’s language.

The contents of the .json are key value pairs, where the key is used to refer to the text in the Text Component and its value is the localized text. Note that your Key should start with the @ symbol.

{
"@key": "Translated Text",
"@key2": "Another Translated Text"
}

Tip: the Localizations Asset only cares about the filename. Within the folder, you can have any structure that you want.

Lastly, you’ll also want to add a strings.json file. The strings.json will be used when the user's device language does not match any of the provided .jsons. This file is also generally used when the user’s device language isEnglish.

Tip: Download an example of this Localization folder

Dynamic Text and Localization

In some cases you may want to add dynamic texts to your localized text. To do so, place the dynamic texts within two curly brackets.

{
"@HelloWorld": "Hello {{DisplayName}}"
}

Adding your folder of localizations as a Localizations Asset

To add your localization folder into your project, in the Asset Browser panel, press +, then Localization.

In your computer file selection window, navigate to the folder you created in the previous step, and press Open.

You should now see your Localization file in your Asset Browser panel.

You can select the Localizations asset and see its content in the Inspector panel.

You can add more than one Localization Assets in a Lens! For example you can use the example localization file, while adding your own based on your needs.

Using your Localized text

To use your localized text, simply use the key you’ve defined before in your Text component!

In your Preview panel, instead of the @Key, you should see its value.

Your Text component should not contain any other characters (including a space) other than the keyword. Since languages may work differently, your localized text should contain the placement for any dynamic text within it.

Testing your Localized text

In the Preview panel, you have the option to simulate how your Lens would look in different languages.

Select the Three Dots in the far right corner of the panel, then select Lens Language, and finally choose the language to preview.

Locale Codes

LanguageTranslated Language NameLocale Code
Arabicالعربيةar_AA
Bengali (Bangladesh)বাংলাbn_BD
Bengali (India)বাংলাbn_IN
Chinese (Simplified)简体中文zh_CN
Chinese (Traditional)繁體中文zh_TW
DanishDanskda_DK
DutchNederlandsnl_NL
English (UK)Englishen_GB
English (US)Englishen_US
FilipinoFilipinofil_PH
FinnishSuomifi_FI
FrenchFrançaisfr_FR
GermanDeutschde_DE
GreekΕλληνικάel_GR
Gujaratiગુજરાતીgu_IN
Hindiहिंदीhi_IN
IndonesianBahasa Indonesiaid_ID
ItalianItalianoit_IT
Japanese日本語ja_JP
Kannadaಕನ್ನಡkn_IN
Korean한국어ko_KR
MalayBahasa Melayums_MY
Malayalamമലയാളംml_IN
Marathiमराठीmr_IN
NorwegianNorsknb_NO
PolishPolskipl_PL
Portuguese (Brazil)Portuguêspt_BR
Portuguese (Portugal)Portuguêspt_PT
Punjabiਪੰਜਾਬੀpa_IN
RomanianRomânro_RO
RussianРусскийru_RU
Spanish (Argentina)Español (AR)es_AR
Spanish (International)Españoles_001
Spanish (Mexico)Español (MX)es_MX
Spanish (Spain)Español (ES)es_ES
SwedishSvenskasv_SE
Tamilதமிழ்ta_IN
Teluguతెలుగుte_IN
Thaiภาษาไทยth_TH
TurkishTürkçetr_TR
Urduاردوur_PK
VietnameseTiếng Việtvi_VN

Last Update: 8/16/2021

Was this page helpful?
Yes
No

AI-Powered Search