Creating an HTML-based online help system using QTextBrowser or QDesk-topServices.openUrl() is straightforward, whereas creating a system that uses Qt Assistant is trickier to set up. But no matter which approach we take to providing access to online help, the real challenge is the design and content of the online help documentation itself.
Setting up an application for translation is quite straightforward. A .pro file is normally used to list the .ts file and the .ui, .py, and .pyw files that have user-visible strings in them, and we must use pylupdate4 and lrelease to keep the .ts file up-to-date and to produce the .qm file. We can avoid using a .pro file by generating the initial .ts file and then using either mkpyqt.py or Make PyQt.
In terms of coding we must make sure that every user-visible string uses QOb-ject.tr() or QApplication.translate(). Strings that have replaceable arguments should always use QString.arg() with its numbered %n arguments rather than the Python % operator.
For numbers we may need to use %Ln to get the correct thousands and decimal separators. One trick we can use for currency symbols is to do something like this:
currency = QApplication.translate("Currency", "$")
and translate "$" as "€", "£", "¥", or whatever else is appropriate. For dates we can use QDate.toString(Qt.SystemLocaleDate) or QDate.toString(Qt.ISODate). For units of measurement it is probably best either to provide a sensible default that the user can change through a configuration dialog, or have a "first run" dialog that asks the user to choose their units, default paper size, and so on.
Was this article helpful?
Discover How You Can Quickly And Easily Dominate Google and YouTube... With Simple Cash Generating Videos. Did you know that YouTube is the second largest search website on the entire Internet? YouTube gets more daily searches than Bing and Yahoo. In fact, there is only one search engine that gets more action.