Skip to content

05. Specials

tetherscript edited this page Jan 31, 2025 · 1 revision

Handling icons, colors and other non-translatables

Caution

Your app could run in languages where, for example, an icon, color, or other item needs to be different from other languages. It’s worth doing a bit of research or user testing for each target market to avoid introducing symbols or colors that may come across as inappropriate or off-putting.

A classic example is using white as a “safe” or “neutral” color in an interface. In many Western cultures, white is associated with cleanliness, simplicity, and purity. However, in several East Asian cultures (such as in China), white is traditionally linked to mourning and death, making it an unappealing choice in certain contexts. Similarly, a well-known icon example is the thumbs-up gesture. While it’s widely seen as a positive “like” or “approval” symbol in much of the world, it can carry offensive or vulgar connotations in some Middle Eastern and West African cultures.

Solution

Add these items to \Translator\Specials.json, with one entry for each item and language. These items will be copied into the correct Resource.resw when you do a Translate.

In your app, you will be able to load these special resources by using TLocalized.LoadSpecial(), or any other method of retrieving a resource.

Example

You have four languages, but ar-SA should have a different icon.

[
  {
    "Key": "SettingsIcon",
    "Value": "settings1.ico",
    "culture": "en-US"
  },
  {
    "Key": "SettingsIcon",
    "Value": "settings1.ico",
    "culture": "de-DE"
  },
  {
    "Key": "SettingsIcon",
    "Value": "settings1.ico",
    "culture": "fr-FR"
  },
  {
    "Key": "SettingsIcon",
    "Value": "settings2.ico",
    "culture": "ar-SA"
  }
]

Accessing in Code

Call the TLocalized.GetSpecial("SettingsIcon") function to get the value that is appropriate for the current culture. Notice that we don't use a hint token ex '@' here, since it is not sent to a translation function.

Clone this wiki locally