Link Search Menu Expand Document

String Resources

Libertas Thing-Apps may need to interact with users in natural language.

For example, Libertas Thing-Apps can send messages to users’ smartphones. We need to be able to localize the Thing-App related text strings.

Managing String Resources

In Libertas Studio, open Thing-App Signature Editor. For every Thing-App function, there is a list of string resource (key/value) pairs.

The string resources can be managed by clicking the “String Resource” button with the Thing-App function selected in the “Functions” panel.

String Resource Button

Translation

String resources can be translated into different languages.

String Resources Editor

With the string resource editor, developers can edit a list of string resources associated with the function.

String Resource Editor

Valid Resource Name

The resource name must match the regex below.

^([a-zA-Z_][\w]*)$
  • It must start with an ASCII letter or “ _ “
  • The following characters must be letters, numbers, or “ _ “

String Formatting

If a Thing-App needs to send a message to users, instead of sending the literal string, it shall send the “string resource name.”

On the user’s smartphone, our Libertas Thing-App will get the best translation of the string resource and get the actual string from the translation with the resource name.

The format follows IEEE printf specification, which is supported on C/C++, Android, and iOS.

%[argument_index$][flags][width][.precision]conversion

For more information about formatting, please visit:

Restrictions

Currently, the format variables are from JSON arrays. So only the following data types are supported:

  • Boolean
  • Floating point
  • String

For more information, please read chapter “Messaging & Notification”.