When I set the current language to Arabic in my UI, just for testing purposes, I see that some English strings (displayed in a language selection dialog, if you're wondering why) are rendered in a way I'm not sure will be appropriate. With the non-Arabic translations, for example, a string that would display as "English (United Kingdom)" will be rendered as "(English (United Kingdom" when the Arabic translator is loaded.

Does anyone know an appropriate way to handle this?

These strings are added to a QComboBox by asking a QTranslator for the translation of the word "English" (something I've used as a hook for finding the name of the language provided by the translation (just as the 'i18n' example did)):

Qt Code:
  1. QComboBox* languageCombo = new QComboBox(this);
  2.  
  3. Translator test;
  4. QStringList translations = test.availableTranslations();
  5. QString translation;
  6. foreach (translation, translations) {
  7. // Remove .qm suffix
  8. translation.chop(3);
  9. test.load(translation);
  10. languageCombo->addItem(test.languageName(), translation);
  11. }
  12.  
  13. Client* client = Client::instance();
  14.  
  15. languageCombo->setCurrentIndex(
  16. languageCombo->findText(client->translator()->languageName()));
To copy to clipboard, switch view to plain text mode 

Where languageName() just has:

Qt Code:
  1. return translate("Translator", SourceLanguage, 0, -1);
To copy to clipboard, switch view to plain text mode 

Where SourceLanguage is just

Qt Code:
  1. static const char* SourceLanguage = QT_TRANSLATE_NOOP("Translator", "English");
To copy to clipboard, switch view to plain text mode 

Any insights much appreciated.