Closed Bug 1018708 Opened 8 years ago Closed 8 years ago

[Vertical] Homescreen should translate Collections names when changing locale


(Firefox OS Graveyard :: Gaia::Homescreen, defect)

Not set


(feature-b2g:2.0, b2g-v2.0 fixed, b2g-v2.1 fixed)

2.0 S4 (20june)
feature-b2g 2.0
Tracking Status
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed


(Reporter: amirn, Assigned: jlal)



(Keywords: late-l10n, Whiteboard: [systemsfe])


(1 file, 1 obsolete file)

Cristian, maybe you can take this as you did excellent work with homescreen1 :)
Flags: needinfo?(crdlc)
Sorry but I have a lot of work with the migration right now mate
Flags: needinfo?(crdlc)
looping :chofmann as :cserran suggested - your feedback on using .properties files? (see description)
Flags: needinfo?(chofmann)
Hi Amir, I'm not exactly sure what the question is.

In general using .properties files is fine, but I'd need a bit more contest. Are collections for vertical homescreen different from the ones we're currently using?
Flags: needinfo?(chofmann)
(In reply to Francesco Lodolo [:flod] from comment #4)
> Are collections for vertical homescreen different from the ones we're
> currently using?

In the vertical homescreen collections are sync over the Datastore by the Collections app.
There will be a build process which will create the initial, pre-installed Collections (bug 1016225).

When a user later changes the locale, the names of the pre-installed collections should update.
The question is - how should we provide these translations?

In the old homescreen we used the .properties files I linked to. We can do the same for the Vertical homescreen unless there a better solution.
(In reply to Amir Nissim ( from comment #5)
> In the old homescreen we used the .properties files I linked to. We can do
> the same for the Vertical homescreen unless there a better solution.

I don't think we have alternative solutions. .properties files are automatically extracted and exposed to localization tools and localizers, so that's definitely the way to go to have those names localized.
We definitely want to use a properties file to localize the strings.

For the locale change, I think one option that might be worth investigating is to see if we can populate a "manifest-like" thing from the collections app. On locale change, we can then have the homescreen perform the localization. So in addition saving the name and pinned results, we could also save a map of string - the same way a mozApp result works. This does create a bit of complexity when we do save the collection, and we would need to know the available locales on the device.

Another option would be to fire an IAC message and have the collections app update each object's name attribute - the datastore sync would just take care of everything.
Amir, This all seems very complicated, and I might be misunderstanding, but I think your question is about how should the localization of "collections" appear when the user changes locale.  I've take a crack at recapping my understanding of the issues based on the things you said above.   Feel free to correct any of this.

The complication is that there is an initial build list of collections (.properties file), then the collections list gets updated from marketplace in a synching process (that works using jason for the transfer?).

So this will mean there should be two sources of "collection lists" for each locale as well.  One in the initial build, and one on market place that the collection app synch's up with.

If a locale change has been made it seems a reasonable UX response should be to go directly to the "collection list" from marketplace, rather than going to the initial build collection list, then updating to the marketplace collection list.

Does that summarize how you expect this to work?

Marketplace gets localized by pei mo and clouserw.  They will have the best idea on how to get collection lists localized and stored on market place that the collection app would synch with.
Just throwing randomly uneducated thoughts into the pot:

This sounds like the contacts API problem, where each consumer of the contacts API needs to localize the field names.

That is indeed a challenge in API design, and if you're having a data-based api like datastore, then, yes, each consumer of that api will need to localize each data item from scratch.
is it possible for an inactive app to observe the device locale?

if there is a way to do that, then the collection app can run a background process when the locale changes, update the datastore and the homescreen will update by the datastore bindings.

this way we can re-use the locale files already in the collection app.
How often will collections change?

For things like: 

  Showbiz = Showbiz
  Social = Social
  Games = Games
  Music = Music

It seems like not very often.  I suspect locale switching happens pretty infrequently as well, but maybe telemetry could tell us something about that.   Is there a UX design for this?

If all the data changes infrequently the design of this for data updates and synchronization might want to follow that idea and be as simple as possible.
From my point of view:

1) User changes the locale En -> Es
2) Homescreen (or system,...) is listening when it happens and via IAC send a message to collection app, hey app "localize" please.
3) The collection app gets locales and via .properties file changes the names for collections in the datastore
4) Automatically all homescreens running or any app listening for changes on the datastore should update labels

What do you think guys?

Thanks a lot
(In reply to Cristian Rodriguez (:crdlc) from comment #12)
sounds good.
when we have steps 1 and 2 implemented I can it from there...
I could take care of the first step but I like to know which app should do it, vertical-home or system, kevin?
Flags: needinfo?(kgrandon)
The homescreen may not be running, so we would need to store the last locale in asyncStorage or something, then check that it's still the same on startup - and if not send a message. It also seems like a lot of work if third party homescreens need to do this.

FWIW - I still like the idea of reading from shared/resources/languages.json and populating a manifest-like with all possible translations on create. It's more complex during create time, but lowers runtime complexity which I like.
Flags: needinfo?(kgrandon)
QA Whiteboard: [VH-FL-blocking-]
QA Whiteboard: [VH-FL-blocking-] → [VH-FL-blocking-][VH-FC-blocking+]
Kevin - Should we call this feature work or a bug? Just want to know which flag I need to set here.
Flags: needinfo?(kgrandon)
However you want to track it. It's part of the feature but also a bug :)

Feature work I guess because it's not a regression?
Flags: needinfo?(kgrandon)
Okay - Candice - Can you add the feature-b2g flag here?
QA Whiteboard: [VH-FL-blocking-][VH-FC-blocking+] → [VH-FL-blocking+][VH-FC-blocking+]
Flags: needinfo?(cserran)
feature-b2g: --- → 2.0
Flags: needinfo?(cserran)
Whiteboard: [systemsfe]
Target Milestone: --- → 2.0 S4 (20june)
Okay- I am going to take a shot at this....

My plan looks like this:

At build time generate .json files which contain a locale manifest (like the mozapps do) this information will be read directly from our localization files (need to make sure this works for both in tree and out of tree locales) 



(this structure intentionally maps directly to the webapp.manifest structure)

  "locales": {
    "en-US": {
       "name": "xfoo"

The collections app will read the json file and add the .locales section to results stored in the datastore. 

The homescreen(s) will read the current locale and look up the correct naming based on the values set in the locales dictionary...

I am trying to avoid the need for issuing many XHR requests to the manifests and then building the manifest from the results of those... This would be fairly slow and easily done later if for some reason we need to fetch manifest names from the locale files directly.
Assignee: nobody → jlal
About this: does the server already have localized names for the collections? If so can we return them in the server request for collections?
Flags: needinfo?(amirn)
(In reply to James Lal [:lightsofapollo] from comment #20)
> About this: does the
> server already have localized names for the collections? If so can we
> return them in the server request for collections?

sure. see
Flags: needinfo?(amirn)
I am going to use a much simpler approach like we used in v1.4 but with a shared locale file rather then trying to use a (IMO better but more complicated) approach that works better for third-party homescreens using datastore.
Works well for me on the collections app and on the homescreen... this requires each new app which uses the collection datastore to also include the l10n ini file I added in shared.

Needs an integration test.
Attachment #8442668 - Flags: review?(amirn)
Comment on attachment 8442668 [details] [review]

please address comments on Github.
Comments addressed
Keywords: late-l10n
Comment on attachment 8442668 [details] [review]

I took a look and it appears everyone's comments are addressed. We also have a green gaia-try build, so I think we are good here. Thanks guys!
Attachment #8442668 - Flags: review?(amirn) → review+
Closed: 8 years ago
Resolution: --- → FIXED
Hmm, looks like we crossed paths with another merge, might just need to update unit tests... I'll take a look.

Resolution: FIXED → ---
Attached file Github pull request
New pull request. I added a single line to the test to include l10n.js as we now need that since crossing paths with a commit that added tests.
Attachment #8442668 - Attachment is obsolete: true
Attachment #8443143 - Flags: review+
Conflicts from cross-merge resolved. Landed:
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Comment on attachment 8443143 [details] [review]
Github pull request

This is needed for the vertical homescreen.
Attachment #8443143 - Flags: approval-gaia-v2.0?(bbajaj)
Attachment #8443143 - Flags: approval-gaia-v2.0?(bbajaj) → approval-gaia-v2.0+
Can you verify this bug?
Flags: needinfo?(tchevalier)
Long press on Home -> Add Smart collections, the list is displayed localized in Italian on my Keon (2.1, git commit 2014-06-20 734d8459). If I switch to English, I get the English descriptions.

If I select one, I don't see it appearing on the home (maybe a different bug).
Hey Francesco - anything in logcat when you see that? Thanks! 

(A lot of pieces for smart collections are landing today, so it may be a bit premature to verify bugs against it)
Used Flod's Italian translations, I also got the list correctly localized.
If I select one, it's correctly added to the Homescreen.

Its name is correctly localized on the Homescreen as well.

However, the name on the header once opened is wrong:

Installed collection-categoryId-296 = Intorno a me
I got "Intorno a me" on the homescreen, but "Vicino a Me" on the header.

Opening a follow-up bug for that.

Tried on Flame with 
Gaia      008b5a4d1be8cb8416543047a748681cc70ea193
BuildID   20140619160205
Version   32.0a2 13 juin 2014, 17:47:02 (UTC-0700)
Flags: needinfo?(tchevalier)
(In reply to Kevin Grandon :kgrandon from comment #35)
> Hey Francesco - anything in logcat when you see that? Thanks! 

Something must have fixed it in the middle: flashed keon with the current tip of master, and it works.

I can confirm the behavior described by Théo: icon's name is localized, but when I open it I get's name, which is different.
Right - we may want to talk to the guys about this. They actually wanted the server to be able to override local translations in certain cases - but it does make sense that the label should match up to the header.
Depends on: 1028325
Depends on: 1028348
Flags: in-moztrap?(tchevalier)
Flags: in-moztrap?(theo)
You need to log in before you can comment on or make changes to this bug.