How to translate dynamic text with String Catalog

My app has the Text views that display the value of variables.

Below are two sample pieces of code and the String Catalog (Localizable.xcstrings) entries created when app builds:

(1) Code: Text("[ (var1) ]")

  • Key: [ %@ ]
  • Default: [ %@ ]
  • Spanish: [ %@ ]

(2) Code: Text("(var2) - (var3) - (var4)")

  • Key: %@ / %@ / %@
  • Default: %1$@ / %2$@ / %3$@
  • Spanish: %1$@ / %2$@ / %3$@

Each of the 4 vars have a discrete number of known possible values.

How do I enter the possible var values and their associated Spanish translations in the String Catalog?

  • What kind of values do var1, var2, ... take? Are those hardcoded values, or are they dynamically built?

  • Values of all the vars change repeatedly at run time based on selections made by the user. For example, var1 is "viewModel.currentCard.fret". The var is always the same but its value changes. Each of the vars has a discrete number of possible values which can be put in a table. Both of my code examples omitted the "" before the "(".

  • Apple Staff... please, do you have further comments or an answer?

Add a Comment