← Back to team overview

ubuntu-phone team mailing list archive

Re: Testing Translations

 

$ LC_ALL=es_AR.UTF-8 LANGUAGE=es qmlscene i18n.qml
qml: Language: es_AR.UTF-8
qml: Dummy domain set
qml:   tr: Done
qml:   dtr: Listo
qml: Correct domain set
qml:   tr: Listo
qml:   dtr: Listo


I don't know jack, but I'd guess different bits of the translation
stack look at different bits of the locale environ. LC_ALL and
LANGUAGE seem to cover what you use.

On 9 September 2014 22:53, Robert Schroll <rschroll@xxxxxxxxx> wrote:
> Hi all,
>
> I recently added translations to my QML app, and I'm trying to test them
> now.  But I'm having trouble getting even a basic case to work.  Can someone
> say what I'm doing wrong?
>
> I've attached a sample program that demonstrates my confusion.  It reports
> the selected language, sets a bogus domain, and translates the string "Done"
> twice, once with tr() and once with dtr() and the "apt" domain.  Then it
> sets i18n.domain = "apt" and does both translations again.  Here's what I
> get:
>
>> $ LANGUAGE=es qmlscene i18n.qml
>> Language: en_US.UTF-8
>> Dummy domain set
>>   tr: Done
>>   dtr: Listo
>> Correct domain set
>>   tr: Done
>>   dtr: Done
>
>
> Note that the language is not detected, but the first call of dtr() gets the
> translation correct.  (The first call of tr() should, and does, fail.)
> However, when the domain is set, neither translation works.
>
> I can also do:
>
>> $ LANG=es qmlscene i18n.qml
>>
>> (process:26027): Gtk-WARNING **: Locale not supported by C library.
>>         Using the fallback 'C' locale.
>> Language:
>> Dummy domain set
>>   tr: Done
>>   dtr: Done
>> Correct domain set
>>   tr: Done
>>   dtr: Done
>
>
> The same thing happens when setting LC_ALL or LC_MESSAGES.  FWIW, a simple
> Python script [1] works with no problems.
>
> Can someone point out what I'm doing wrong?  I'm using 14.04 with the SDK
> team PPA, if that matters.
>
> Robert
>
> [1] Namely,
>>
>> import gettext
>> gettext.textdomain("apt")
>> print gettext.gettext("Done"), gettext.dgettext("apt", "Done")
>
>
>
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp
>


Follow ups

References