How would I go about adding multi language support to a program, that is written in python, with a QT frontend?
For instance when you ran it and your environments language was set to english it would open a window saying hello, but if your environment was set to spanish it would say hola.
I'm not really sure where to start, so if someone could point me in the right direction to some tutorials, or some documentation on how to do it, I would greatly appreciate it.
EDIT:
I should add, I'm using pyqt4
Edit:
Ok, I have generated all the translation .qm files, but how do I go about adding the python code to use them? There is even less information about this it looks like...
The answer I eventually came up with was using the code below.
from PyQt4 import QtCore, QtGui
from locale import getdefaultlocale
app = QtGui.QApplication(sys.argv)
locale = getdefaultlocale()
translator = QtCore.QTranslator(app)
translator.load('/usr/share/my_app/tr/qt_%s.qm' % locale[0])
app.installTranslator(translator)
Related
Read this(from the Qt website):
http://i.stack.imgur.com/lZW45.jpg (http://doc.qt.io/qt-5/qtgui-module.html#details)
It says that it provides OpenGLin it.
So can i use QtGui class instead of glew/glfw/SDL library for OpenGLwork?
Yes you can. If you're already using Qt, you have the advantage of everything else also being Qt, otherwise you might (depending on the other framework) need to handle e.g. input in a special way.
You could use Qt to get a platform window and an OpenGL context for rendering. However, Qt is a huge framework, and it doesn't make much sense to go for it if that's all you need.
I am trying to develop a Qml based QT application which will support multiple languages.In the application there will be drop down list from where on select of language whole language family of the application will be changed.Can anyone help me on that giving idea how to proceed?
Is there any example? and is QTranslator() is the convenient way to do this?
The localization system of Qt is well documented: Internationalization with Qt
Simply you put your text directly in the C++ code, using the tr() method of QObject (or qsTr() in QML). Than there are some tools (lupdate and lrelease) to generate the translation files. I suggest to read the documentation, it's very easy.
Some useful links:
Hello tr: and example
Qt Linguist manual
QTranslator works well with Qt UI as you can use languageChanged() signal to update the UI. This isn't possible with QML.
See this QML WiKi, it is the recommended workaround (for now!).
Is it possible to use Doxygen on classic-asp-files (written in VBscript)?
I found something called vbfilter.py, but I don't know how to use it. Can somebody please help me?
Finally, i could get it running.
requirements:
python 2.x
https://code.google.com/p/doxy-filter/source/browse/trunk/vbfilter.py?spec=svn1&r=1
download the vbfilter.py from Basti Grembowietz
in vbfilter.py modify def filter. you have to add a line for "asp".
then save the file in the root directory of the project
in Doxygen-settings, in the expert/input-area you have to set input_filter to vbfilter.py and the file_patterns to *.asp
(if you have python 3.x, there is another version, but take care. it's optimized for japanese usage. somewhere in that vbfilter.py codepage is set to CP932 and you have to set it to IS-8859-15 or whatever you need )
Looks like you will have to ask the developer to add support for classic ASP. The "vbfilter.py" you found is Python, really not relevant as far as I can tell.
In the official page he says:
You can submit enhancement requests in the bug tracker.
I would be grateful if someone can help me.
Is there a way to use russian to english translation. (word per word, not sentences)
I've heard and tried google translate API, however I need the program to work with large amounts of words and not be tied to Internet connection. Maybe, some standalone dictionary.
I've found this dictionary : http://sdict.com/en/view.php?file=rus_eng_full2.dct and tried to apply dictconv linux utility to convert to plaintext, so I can use it, but it crashes and compiling it from source doesn't work.
Maybe, someone knows a way to read .dct format and have an open source solution for it or link to it. I haven't found.
If there's a reliable Internet based solution, I would also like to hear about it.
Thank you, world, in advance.
If you are okay using python download sdictviewer-lib from here
https://github.com/jmhobbs/sdictviewer-lib
And use following script to read
import sdictviewer.formats.dct.sdict as sdict
import sdictviewer.dictutil
dictionary = sdict.SDictionary( 'rus-eng.dct' )
dictionary.load()
dictionary.get_word_list_iter('russianword')
I'm about to make a program (qt/gtk) where I need to display some kind of UML diagrams (like in BlueJ),
I wanted to ask you if there is such a component in GTK
It must work with new version of Gtk - gi.repository
The name of library is enough for me, I'll read docs, but if somebody post here some simple demo, it'll be appreciated.
Thank you
Dia (Old homepage) is a GTK based UML drawing tool. It is a very good tool with a lot of options. It is available on a number distros from their repositories. It has both application & library (libdia) components. There are python bindings available as well. If you have not checked it out, you should.
Hope this helps!
I found gaphas
You should checkout GooCanvas, I think is the more complete library for that kind of work.
I use python and pygtk, and use matplotlib to draw graphs in the GUI.
See a sample here : http://www.serpia.org/blog/2007/nov/03/matplotlib-and-pygtk-app/