← Back to team overview

ubuntu-touch-coreapps team mailing list archive

[Calendar] Formatting dates and times

 

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


Follow ups