Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] Bug in Qt's translations on Mac OSX: garbled app menu item in some languages?
Edit: nevermind. I had cut and pasted a qt_pt.ts file, from gitorious website to a file on my PC. For unknown reasons, that causes problems with Unicode strings. What works is to git clone the qttranslations repository, and copy .ts files from there. The rest of this thread is of dubious value....
If you use git to doOn OSX, some languages, some items in the app menu are garbled (don't display with the proper glyphs.) For example, in Portuguese and French, the 'Preferences' item is garbled. For example, in Portuguese, it appears something like 'Preferncias' (where * represents a glyph), but I think the '' should display as one glyph (an 'e' with a 'hat' over it.)
Has anyone seen this, or can explain any ways to properly fix it? (I am not an expert at unicode issues.)
I think it should be reported as a bug. But I'm not sure whether its a bug in the Qt library code or in the translations (which are provided by third parties.) I think it probably affects other strings in the qt_pt.ts file (not just for the Mac app menu.) I don't think it is a problem with the way I have configured my OSX, but it could be.
I think I could workaround by providing my own translation (in context MAC_APPLICATION_MENU) that is used ahead of the translator using Qt's qt_pt.qm file.
Browse to gitorious qt/qtranslations/translations/qt_pt.ts. In a Firefox browser, the translation string for 'Preferences' appears one way (the correct way?.) Then open the 'raw blob' and it appears another way (as it does on OSX, with extra glyphs.)
I'm thinking that OSX uses UTF-8 and the translated strings are proper UTF-8. But I'm wondering whether it is about precomposed versus decomposed, see "here":https://developer.apple.com/library/mac/qa/qa1235/_index.html .
I'm also wondering whether .qm files are portable. I ran lrelease (to create my .qm files, including qt_pt.qm) on Linux, and just copied the .qm files to my Mac development machine. In other words, does lrelease 'understand' the differences in unicode on the different platforms, so that I need to run lrelease on the target platform?
(As well, I'm using PyQt and using pyrcc to put the .qm files in foo_rc.py resource file, which is actually what I copied to the Mac.)
Did you check the "bug report system":http://bugreports.qt-project.org to see it it's something known ?
By the way, what version of Qt and OS X are you using ?
I just checked the bug reports. I don't see this exactly, but I see many related, recent bug fixes that I will explore.
OSX 10.9 Mavericks, Qt 5.3 (5.3.1 ???)
You might want to try the 5.3.2 snapshots
I think I am using the latest commit of qt_pt.ts, from gitorious the qt/qt repository (isn't that the snapshot?) Instead, maybe I should be using the stable .ts or .qm file shipped with the version of Qt I am using (since the snapshot of the translations may not have been modified yet to keep up with any changes to Qt executables?)
I used od (the octal dump tool) to inspect the file. A .ts file is XML and says at the top it is UTF-8 encoded. Decoding it by hand as UTF-8, I think the 4 bytes that should be just two bytes for U+00e7 (Latin small letter c with cedilla) definitely code for U+00c3 and U+0083 (the same wrong glyphs that you see either using Linguist or viewing the raw blob in a browser.) But I still don't understand how a browser to the source (not the raw blob) shows the correct glyph. It really baffles me, but that might explain how some translator-person was fooled into thinking it was correctly translated.
I will take it up on the mail list for translators. I think this is a bug in translation, not in the executable source, and QTBUG tracker for the component L10N (translations) is apparently not the right place. I haven't talked to any persons-who-are-translators yet, I don't know whether they track such things.
Can you create a minimal application + translation that reproduces this ?
Yes, I could provide a small Python/PyQt app + qt_pt.qm. The app would display a QErrorMessage of type Debug, whose translation is also bad (it's not just the Mac application menu, and not just on OSX.)
But is that necessary, since if it it looks wrong in Linguist on any platform, one can say it is a wrong translation? Example: open Qt Linguist on qt_pt.ts from the repository. Look at the source text "Debug Message" in the context "QErrorMessage". The translated text wrongly has capital letters in the middle of words (which I think is wrong in most words of most Latin languages, except for proper names like McTavish.) (This example would rarely be noticed. The example for the MAC_APPLICATION_MENU context is more important.) It's not just the Portuguese translation either, there are examples in the French translation.