Thanks, didn't look at the QCoreApplication::installTranslator().

I used the sample piece you provided as follows (mind dash as prefix):

translator.load(locale, "sailfishsilica-qt5", "-",
"/usr/share/translations");

Anyway, it seems to do only part of the job, which is strange considering
it contains all the strings needed. E.g. I get days of week translated, but
months aren't, as well as remorse "in %1 seconds" text.

Since startup time is not crucial for me at the moment I'll check on that
whole invoker stuff some time later. Thanks for your help!

Cheers

2015-04-24 21:37 GMT+06:00 Andrey Kozhevnikov <coderusin...@gmail.com>:

>  So, you install multiple translators, not load multiple times, and it
> will work.
>
> 24.04.2015 20:23, Dmitriy Purgin пишет:
>
>   Hi Andrey,
>
>  thanks for suggestion. Unfortunately, according to Qt documentation for
> QTranslator::load():
>
> > The previous contents of this translator object are discarded.
>
>  So you load either sailfishsilica-qt5 or strings for your application.
>
>  Regards
>  Dmitriy
>
>
> 2015-04-23 11:01 GMT+06:00 Andrey Kozhevnikov <coderusin...@gmail.com>:
>
>>  This is my solution for you:
>>
>>
>>     QLocale locale("fi_FI");
>>     QLocale::setDefault(locale);
>>     translator.load(locale, "sailfishsilica-qt5", "",
>> "/usr/share/translations", "");
>>
>> 23.04.2015 08:55, Dmitriy Purgin пишет:
>>
>>   Hi,
>>
>>  thanks for reply.
>>
>>  I do install custom translations with QApplication::installTranslator()
>> and it does work on Sailfish but as I mentioned before formatting
>> facilities and system messages stay in OS language.
>>
>>  Regards
>>
>> 2015-04-23 0:07 GMT+06:00 Ove Kåven <o...@arcticnet.no>:
>>
>>> Den 22. april 2015 18:56, skrev Dmitriy Purgin:
>>>
>>>> $ LANG=ru_RU invoker --type=silica-qt5 appbin
>>>>
>>>> does not  change the app locale, it behaves as if there were no
>>>> LANG=ru_RU at all. So does QLocale::setDefault().
>>>>
>>>
>>>  I think setting environment variables and calling QLocale::setDefault
>>> only works if Qt has not yet been initialized. Since the invoker has
>>> already initialized Qt, changing the default locale is probably impossible.
>>>
>>> It seems possible to force Qt to use different translations, though,
>>> with QApplication::installTranslator. Just load the necessary Russian
>>> translations and install them, and Qt will use them. There's an example on
>>> http://wiki.qt.io/How_to_create_a_multi_language_application, but not
>>> sure how it would work on Sailfish...
>>>
>>>
>>> _______________________________________________
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>>
>>
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>>
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscr...@lists.sailfishos.org
>>
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to