← Back to team overview

ubuntu-touch-coreapps team mailing list archive

[Clock] How to transfer translations between C++ / QML

 

Hello everyone,

In the Clock App, we maintain a list of about 250 popular/commonly used
locations which have been translated to various languages. The user sees
this list when opening the add-world-city page where he can choose which
cities to add to the main clock page. The cities he add are stored in the
user-database file.

Recently we found an issue in the Clock app that results in the added user
city names not being translated when switching the system language. It
became apparent that user added locations are stored in the database as
translated strings. Thereby when the user switches the phone language, the
previously translated strings are retrieved from the database and shown in
the UI in the language previously used by the user.

Steps to reproduce the bug,
1. Assuming your phone is used with Language A, open clock app and add few
locations.
2. Change phone language to B.
3. Open Clock App

What happens:
4. Notice how the added cities are shown in Language A

What is expected:
4. Previously added cities are shown in Language B

Bug report:
https://bugs.launchpad.net/ubuntu-clock-app/+bug/1477492

The location is stored with following format:

  "worldlocation":
  {
     "city": city,
     "country": country,
     "timezone": timezone
  }

In that case "city" is the stored localized name. It is causing the above
issue.

My idea is to store the "cityID" instead of the localized "city". "CityID"
will be untranslated universal names like "london", "berlin". I have
created branch, in which I'm storing "cityId" instead of localized city
names. The idea is to then use this "CityID" and then return the translated
cityNames on the fly.

My question is how do I use the generic "cityID" to retrieve the translated
city names from the popular city location list mentioned above? I
understand the situation is a bit difficult to understand. If you have any
further questions about this situation, I can try explaining in more detail.

Thanks in advance
Bartosz

Attachment: screenshot20150731_160143213.png
Description: PNG image


Follow ups