Skip to main content
Version: 12.10.0

Localization Module

The Localization Module should be used to receive localized strings. This module will make sure that a certain Key gets translated and enriched with more informations and markdown info.

This Module can:

  • translate a Key in the from the backend provided languages
  • replace os-independant placeholders with os placeholders
  • replace global variables with specific values
  • give access to a wide variaty of formatters
    • Date & Time formatter
    • Currency formatter
    • Distance formatter
  • replace HTML tags
  • formats phone numbers and emails and handles tap action
  • replace array of string into bullet points.

1. Localization of Content String from CMS

{
"base": {
"key_without_any_placeholders": "Das ist ein Text",
"key_with_placeholders": "Das ist ein Text mit ##[ARG]##",
"key_with_multiple_placeholders": "Das ist ein Text mit ##[ARG]##, ##[ARG]## und ##[ARG]##",
"key_with_standard_variable": "Mein Name ist ##[INSUREE_NAME]## mit der KVNR: ##[INSUREE_KVNR]##",
"key_with_standard_variable_and_placeholder": "Mein Name ist <b>##[INSUREE_NAME]##</b> und dies ist eine ##[ARG]##",
"key_with_phone_number": "Das ist eine Telefonnummer <a href=tel:9999777722>9999777722</a>",
"key_with_email_address": "Dies ist eine E-Mail-Adresse <a href=mailto:support@aok.com>support@aok.com</a>",
"key_with_bullet_points": "<ul><li>Das ist eine Telefonnummer <a href=tel:9999777722>9999777722</a></li> <li>Dies ist eine E-Mail-Adresse <a href=mailto:support@aok.com>support@aok.com</a></li></ul>",
"key_with_highlight_text": "Das ist ein <highlight>Text</highlight>"
}
}

Placeholder

Placeholder are entered via the CMS in the translated Strings using these this pattern: ##[PLACEHOLDER]##, where PLACEHOLDER can be replaced with certain Keys. Dependant of the Keys different standard Texts will be injected or replaced with context text.

IMPORTANT: Usage of the ARG Placeholder must always be aligned with the development Team!

PlaceholderDescriptionCMS StringIn-App-Result
ARGThis Parameter will be replaced with contextual values from the code at runtime. This could be a date or something similar"Das ist ein Text mit ##[ARG]##""Das ist ein Text mit Platzhalter"
INSURANCE_NAMEReplaces the Placeholder with the current Insurance Name"Das ist meine AOK: ##[INSURANCE_NAME]##""Das ist meine AOK: AOK Plus"
INSUREE_NAMEReplaces the Placeholder with the current Insurance Name"Das ist mein Name: ##[INSUREE_NAME]##""Das ist mein Name: Qjbbaaab Hbwaaaac"
INSUREE_FIRST_NAMEReplaces the Placeholder with the current Insurance First Name"Das ist mein Name: ##[INSUREE_FIRST_NAME]##""Das ist mein Name: Qjbbaaab"
INSUREE_LAST_NAMEReplaces the Placeholder with the current Insurance Last Name"Das ist mein Name: ##[INSUREE_LAST_NAME]##""Das ist mein Name: Hbwaaaac"
INSUREE_KVNRReplaces the Placeholder with the current Insurance Name"Das ist meine KVNR: ##[INSUREE_KVNR]##""Das ist meine KVNR: Q123456789"

HTML Support

The App supports certain HTML Tags in text:

  • underline <u>...</u>
  • bold <b>...</b>
  • italic <i>...</i>
  • links <a href="https://google.com">...</a>

These Tags can also be combined with the Placeholders from above: "Das ist meine KVNR: ##[INSUREE_KVNR]##"

Phone Number and Email Support

The App supports phone number and email tags in text:

  • phone number <a href=tel:XXXXXXXXXX>XXXXXXXXXX</a>
  • email address <a href=mailto:support@aok.com>support@aok.com</a>

Bullet point Support

The App converts string array into bullet point seperated items

  • Array to HTML format Example Input : [“Item1”,”Item2”,”Item3”] Output : <ul><li>item1</li><li>item2</li><li>item3</li></ul>

  • HTML format to Bullet point lists

<ul><li>Das ist eine Telefonnummer <a href=tel:9999777722>9999777722</a></li> <li>Dies ist eine E-Mail-Adresse <a href=mailto:support@aok.com>support@aok.com</a></li></ul>

Highlight tag Support

The App supports highlighting part of text

  • highlight <highlight>....</highlight>

Code Implementation

There are two functions based on strings that can be used to receive a localized string for a key

functiondescription
localizedGives the localized strings for the given key. This method also applies Placeholders, except the ARG Placeholder
localized(args)Gives the localized strings for the given key. This method also applies Placeholders, where args are applied to the ##[ARG]## Placeholder pattern

Example:

OCText("key_without_any_placeholders".localized)
OCText("key_with_placeholders".localized("Platzhalter"))
OCText("key_with_standard_variable_and_placeholder".localized("Dokumentation"))

results in

Das ist ein Text
Das ist ein Text mit Platzhalter
Mein Name ist Qjbbaaab Hbwaaaac und dies ist eine Dokumentation

Tracing CMS and Service BE Workflow