@thierryhenry14 said in How can I programmatically translate a QTranslator-translated string back to english?:
Now my problem is that the backend expects the configuration settings to be sent in english. So for example, if there's a config combobox with the choices ["Red", "Blue"], the spanish-translated app would show ["Rojo", "Azul"], but if the user selects the 2nd choice and presses OK, I need to send "choice=Blue" over the network.
With the proviso that I have not used QTranslator/tr("..."). This specific case is easy. Every library has a way of setting a combobox/dropdown item to have a display string but also a "value", which (if absent) will default to the display string, but can be set separately. For QComboBox the value is a QVariant and can be set in a variety of ways including addItem(const QString &text, const QVariant &userData = QVariant()) and QComboBox::setItemData(int index, const QVariant &value, int role = Qt::UserRole) and retrieved via QVariant QComboBox::itemData(int index, int role = Qt::UserRole) const, or you can do same via the QAbstractItemModel *QComboBox::model() const. Since you know you always need the English word from a Spanish choice you should store the original English word as the value while allowing the translation for the text. This is what @SGaist was referring to in his reply above.