Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt Linguist - Create Limitations
Here is a scenario:
I need to add translations for my application. My application has approximately 300 strings in 18 languages.
To help me adding translations, there are other team members will be working on adding the translations.
Here are my requirements for the translations:
- Translations should not exceed 20 characters. If the translation exceeds 20 characters, the translation shall be shortened. Example: If the translation is Engineering, then shorten it to Engg.
- Translations shall not have special characters like @, #, $, etc.,
Having the above said as the requirements, I want the team members to add the translations.
Here comes my question: Can we create rules or limitations for Qt linguist to restrict the translation fields or set the validator to check if the translation meets the requirements?
If the current Qt linguist doesn't supports, is there any configuration file, where I can add the validation rules?
Or can we customize Qt linguist to work as per our need?
You would have to modify Linguist source code. The tool does not provide the functionality you require, at least as far as I know.
Can I get the linguist source code? Can you please let me know the right path to download?
You need to download the Qt source code. Linguist can be found in the qttools repository (qttools/src/linguist). There are many places from where you can download:
- if you want just the qttools, you can get them from official split packages: "link":http://download.qt-project.org/official_releases/qt/5.3/5.3.2/submodules/
- if you prefer full Qt source code, look here: "link":http://download.qt-project.org/official_releases/qt/5.3/5.3.2/single/
- you can also use git
- you probably could install the source components through your Qt installer, but I am not sure those can be used for compiling
A general guide on compiling Qt 5 can be found here: "link":http://qt-project.org/wiki/Building-Qt-5-from-Git. For Linguist, however, it should be enough to simply open the .pro file in Qt Creator and compile directly.
Just to be clear, I am not looking for Qt creator or development environment for now.
I am looking for updating Qt linguist application to create the limitations in the translation fields.
Is it possible to update the source code of Qt linguist? And after I do the update in Qt linguist source code, how do I build as .exe?
Please let me know.
[quote author="kumararajas" date="1417164703"]Is it possible to update the source code of Qt linguist? And after I do the update in Qt linguist source code, how do I build as .exe?[/quote]
Yes, I have just given you the instructions on how to do it. The easiest way is to use Qt Creator. And you need Qt and a compiler installed on your machine - otherwise you will not be able to compile Linguist. Of course, if you don't want to see Qt Creator, you can do all by hand, changing the source code in Notepad++ or UltraEdit (or Notepad if you feel suicidal), and then compile from the command line. The choice is yours.
JvdGlind last edited by
You could always open the .ts files and parse them as XML. Then look for <translation> and check if it meets your requirements.
This does not provide direct feedback to the user, but only feedback after saving the file and running the XML parser.