[i18n] Cannot use the i18n plugin in C++

Bug #1182577 reported by David Planella
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Fix Released
Wishlist
Cris Dywan

Bug Description

For SDK apps developed in QML and C++ it would make sense to be able to use the i18n plugin consistently. I.e.:

1) To translate a string in QML: i18n.tr("Translate me!")
2) To translate a string in C++: UbuntuI18n::tr("Translate me!");

Of these, 2) is currently not possible, although there is a workaround to use plain gettext in C++: C::gettext("Translate me!")

A use case is the phone-app, written in C++ and QML. Here's a merge proposal for internationalization that illustrates the point:

https://code.launchpad.net/~renatofilho/phone-app/translation/+merge/165897

Tags: i18n touch-cn

Related branches

David Planella (dpm)
description: updated
Revision history for this message
Florian Boucault (fboucault) wrote :

The browser use case is invalid since the window title should be set from QML:
http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick-window2-window.html

Generally speaking I would not like to expose a C++ API if we can avoid it. So far we were able too :)

Changed in ubuntu-ui-toolkit:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Tim Peeters (tpeeters) wrote :

So I close this bug until there is a use case and using gettext directly turns out to be a bad choice there.

Changed in ubuntu-ui-toolkit:
status: Confirmed → Won't Fix
Revision history for this message
David Planella (dpm) wrote :

I've just found a use case: the Phone app uses gettext:

https://code.launchpad.net/~renatofilho/phone-app/translation/+merge/165897

description: updated
Revision history for this message
Tim Peeters (tpeeters) wrote :

I re-opened it because of the use case in the phone app. We'll still need to evaluate what's the best solution here.

Changed in ubuntu-ui-toolkit:
status: Won't Fix → Confirmed
Tim Peeters (tpeeters)
summary: - Cannot use the i18n plugin in C++
+ [i18n] Cannot use the i18n plugin in C++
Revision history for this message
Cris Dywan (kalikiana) wrote :

This works in trunk, I'm not aware of a specific change, but I'm linking the branch that adds test cases including using C++ API so that might be worth comparing to if something appears to not work.

Changed in ubuntu-ui-toolkit:
status: Confirmed → Fix Committed
tags: added: touch-cn
Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
assignee: nobody → Christian Dywan (kalikiana)
Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Michał Karnicki (karni) wrote :

Has the merged change been documented?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.