PDA

View Full Version : How to handle that some texts should differ from the language file?



tomasl
24th August 2011, 21:16
Hi,

in our previous non-QT application we used a unique identifier for each text string in the program. The identifier and language-specific texts were stored in a database and read whenever the GUI needed them. End-users had the possibility to change some of these texts if wanted.

When using tr() and Linguist in QT, this is brilliant for translating the application to several languages, and switching between them by simply changing loaded qm-file. I wonder however how I could easily let the end-user change just some of the texts in their application. Say that the app has 2000 strings that is translated to their language, but 10 of them need to be changed since their industry require a different text.
I would prefer not to make a whole new qm-file for the specific industry in each language. If I could let the tr() method first check if the string was present as an item in the database, otherwise use the text from the qm-file, this might be a solution, but I'm not sure if it is a good one.

Any ideas on how to solve this? Thanx

llev
30th August 2011, 03:01
I guess you may subclass QTranslator, override translate() method and then put that translator object on top of translators stack.
How do you think?