← Back to team overview

ubuntu-touch-coreapps team mailing list archive

Re: [Calendar] Formatting dates and times

 

Yes,

I had eggs on my eyes, there's an "i18n.language" property,
which we can easily pass on to the locale aware date formatting...

Thanks Tim!

On 03/18/2013 05:49 PM, Tim Peeters wrote:
> Hello,
> 
> I implemented i18n in the Ubuntu UI toolkit. It is simply a binding to
> gettext, and i18n.language is initialized from the environment
> variable LANGUAGE. The reason that we use this and not the built-in
> internationalization from Qt is that we want to use gettext tools,
> including the translation features provided by launchpad.
> 
> So try exporting LANGUAGE in the terminal from which you run your app
> (or set it in the QtCreator Run environment if you use that). If I am
> not mistaken, the format of the LANGUAGE parameter is the same for
> gettext and Qt.locale(). For example, for Dutch I use LANGUAGE=nl_NL.
> 
> Unfortunately the i18n/l10n in our SDK is not yet well-documented, but
> I will be working on that.
> 
> Greets,
> 
> Tim.
> 
>> Hi,
>>
>> I think it would be good if we could decide on how to do date and time formatting. The problem is that Qt.formateDate()-family of functions does not seem to handle language changes will the application is running.
>>
>> Frank pointed out the Qt.locale() (http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-locale.html) function which returns a js object with properties and functions capable of formatting dates and times.
>>
>> The Qt.locale() function can take one parameter, a locale name specified in the following format "language[_territory][.codeset][@modifier]".
>>
>> With some luck we could use Qt.locale() together with i18n.language-property, depending on how the property's value looks like.
>>
>> For example: Qt.locale(i18n.language).formateDate('MMMM')
>>
>> Are there any SDK developer who can confirm if this is the case?
>>
>> On the desktop, i18n.language was just an empty string
>>
>> --
>> Mario Boikov
> 


-- 
Cyblogic / Frank Mertens
Dornierstr. 19c
82110 Germering

gplus.to/frankencode
frankencode@freenode


References