On 07/31/2012 01:16 PM, [email protected] wrote: > You should uninstall the old one. For several translators it's better if we > use either several TranslationLoader elements or have a special property > taking an array of source files.
I have done what you suggest, and uninstall the old translator. I have pushed a proposal to codereview: https://codereview.qt-project.org/#change,31864 The sanity bot doesn't like the .qm files (one good, one invalid) I included in my unit tests. Any suggestions, short of renaming the files to some other extension? > >> b/ if any texts have already been run through qsTr, with my current >> implementation they are not be re-translated upon successful loading of the >> translation. Is there a signal or something I can tack onto to trigger a >> retranslation? For now I have worked around this in my application by only >> loading the QML files which require translation once the TranslationLoader >> has finished loading (successfully or with an error). > It'll require a bit of work in in QtQml/QtQuick. Qt sends a > QEvent::LanguageChange to all top level windows when a translation gets > loaded or removed. So you'll need to add a hook listening for the event in > QQuickWindow. OK that sounds like a different change, this behaviour would make sense whether you're installing your translations from QML or from C++. > >> c/ I noticed that (at least in Qt 4.8) classes such as FontLoader have a >> special code path (protected by ifdefs) for handling local files. Should I >> be doing the same, I was under the impression QNetworkAccessManager already >> had provisions for handling local files? > I think the special code path is there for performance reasons. I'd go > through QNAM for now, and once that's properly implemented check whether > optimising for local files is worth it. OK, I send all requests through QNAM for now. One other thought came to mind: a typical use case will be that the user wants to load such or such .qm file depending on the current locale. Unfortunately I don't think QLocale is accessible from QML. Would a constant "localeName" property make sense in TranslationLoader? Cheers, Jeremy _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
