Swift program.

Help is needed:
I'm trying to Russify the title in the navigation bar :

 self.title = NSLocalizedString("Question # " + String(numberOfQuestion), comment: "title with question number") 
  <trans-unit id="Question # "> <source>Question # </source> <target>Вопрос № </target> <note>title with question number</note> </trans-unit> 

However, the inscription remains in English, as written in source .
Translation for other strings works well.

Maybe the thing is in + String(numberOfQuestion) ?
Tried it like this, but with the same result: "Question # \(numberOfQuestion)"

    2 answers 2

    In runtime "Question # " + String(numberOfQuestion) will be a new string, different from the one that has localization. First try without the + String(numberOfQuestion). add it after NSLocalizedString

    I can advise a fairly convenient library for localization, which was forced to use in a new project: https://github.com/marmelroy/Localize-Swift , but again, it all depends on the needs and not the fact that you need it.

    • Thank you very much! Indeed, the variant with self.title = NSLocalizedString("Question # ", comment: "title with question number") + String(numberOfQuestion) perfectly localized! I will look at the library later - not yet needed - GenDru
     self.title = "textForNivagatorbar".localized()