If you have global users of your app, you should send messages in your users' local language. Localytics automatically detects the language from the settings on a user's device and assigns this as a Profile Attribute. The language is saved as a two-character code using the ISO 639-1 standard. Again, you should review the User Profiles section to understand how Profiles work. Localization uses Liquid templating; for more details read our Liquid templating section.
Achieving Localization is very straightforward. In the same way that you achieve personalization by using Profile attributes to dynamically create messages, you can include instructions that tell Localytics to send different messages based on the language setting on a user's device. A few commonly used languages and their language codes are below, followed by an illustration of how to achieve Localization.
Language | Code |
---|---|
English | en |
French | fr |
Spanish | es |
Consider using Localization to:
- Send messages in a user's native language. For example, Salut, mon amie! for users with French as their device language, Hola, mi amigo! for users with Spanish, and Hello, my friend! as the default for all other users.
-
{% if _ll.language == 'fr' %}
Salut, mon amie!
{% elsif _ll.language == 'es' %}
Hola, mi amigo!
{% else %}
Hello, my friend!
{% endif %} - Send localized messages for the most common foreign languages and use fall-back logic to default to English (or another language) for everyone else.