Skylight Docs

String localization

This is a recipe showing how to localize strings based on the user's context.
skylight-export-Recipe_ String
String Localization Recipe Application Bundle
Example of application responding to user locale updates

What does this recipe include?

The application data for this recipe stores the translated string values:
"defaultLocale": "en",
"strings": {
"welcome": {
"en": "Welcome!",
"es": "Bienvenidas!",
"de": "Willkommen!",
"fr": "Bienvenue!",
"pt": "Bem vindo!",
"it": "Benvenuta!",
"zh": "欢迎!",
"ja": "ようこそ!"
If the user's locale is set to "Domain Default", skylight.user.localewill return an empty string. There is currently no way to retrieve the domain's default locale, so we store the default locale in application data (which will need to be updated whenever the domain default is updated).
The root view contains a single card that has its text bound to:
{{[user.locale ? user.locale :] }}
This databinding accesses the appropriate welcome string from application data using the user's locale. If the user's locale is an empty string, we use the default locale specified by the application data.
This card also has an onSelect action that runs the following script when selected:
const applicationStrings =
const welcomeStrings = applicationStrings.welcome
// If user.locale is an empty string, that means that it is currently set to the domain default.
// In the future, the domain default locale will be accessible through the scripting API; for now
// we resort to storing it in a value in application data
const locale = skylight.user.locale ? skylight.user.locale :
const localizedWelcome = welcomeStrings[locale]
body: localizedWelcome
This script uses a logic similar to the text databinding to show a localized notification.
For more details on localization in Skylight, see
For more details on retrieving the user's locale using the scripting API, see