Closed Bug 1546999 Opened 5 years ago Closed 5 years ago

Investigate the ability to localize Top Sites suggestions

Categories

(Firefox for Android Graveyard :: Awesomescreen, enhancement, P2)

Firefox 68
Other
Android
enhancement

Tracking

(firefox68 affected)

RESOLVED WORKSFORME
Tracking Status
firefox68 --- affected

People

(Reporter: petru, Assigned: brad.arant, NeedInfo)

Details

(Keywords: good-first-bug, Whiteboard: [bcs:p1])

The current Top Sites suggestions were added 4 years ago - bug 1216987.

How this default Top Sites are used in code - bug 1208410 comment 4.

Given that images are to be included as resources in the app we need to investigate the feasibility of having different Top Sites suggestions for all different locales and generally what the process for this would involve.

Localizing them was also something the iOS team investigated in bug 1413890

Keywords: good-first-bug

List of sites is being finalized with Andreas. Needs some more product/legal input before actually worked on but the investigation can still occur.

Whiteboard: [bcs:?]

Andreas is getting closer here.

Setting priority so we don't lose it.

Flags: needinfo?(abovens)
Priority: -- → P2
Assignee: nobody → brad.arant
Whiteboard: [bcs:?] → [bcs:p1]

Quick assumptions discussed today: hard-coded list, could potentially access Leanplum variables for some dynamic results? may be over complicating, either way just trying to keep simple and target the locales and piggy-back on what we already know/have.

I would say the next step here is to just test locally what's needed to add a new set of TopSites for a different locale and test the behavior in the case of a locale change.

As per bug 1208410 comment 4 it seems we can have different TopSites depending on both the language and the region.
So we could have something like en-US and also en-ES and changing between the resources in region.properties would be done automatically like in the case of the strings automatically changed when the locale is changed on the device.

The Locale object is quite extensive with language and all sorts of other detailed information about language, etc. I believe we really just want to check the country code instead of worrying about language. For instance, in Canada there is a large french speaking community but is there a different Amazon for the french speaking Canadians versus other languages in Canada?

The list selection will require top websites based upon the country (region) according to the IANA Language Subtag Registry which reflects ISO 3166.

Just a warning, there are a ton of these codes (over 200). Are we intending to provide a list for every one of these?
https://www.iso.org/obp/ui/#search

So for the USA you would retrieve a country code from the locale as US. England would be GB. This should be sufficient to select a regional list of URLs for the top sites. The language portion shouldn't really be needed as the app an websites used will reflect the languages used in those areas.

A simple hardcoded static method could be created to return the an array of URLs but it will be a large method as there are over 200 country codes.

If it is needed that in a particular country there is multiple languages to choose from in URLs then we can easily add that selection into the method where it is required.

Investigated this and found that we already have in place all that it's needed.
The default TopSites suggestions are in mobile/locales/en-US/chrome/region.properties
and in the build process python/mozbuild/mozbuild/action/generate_suggestedsites.py generates a suggestionsites.json containing them.
To note here is that the imageurl refers to an existing drawable with the name suggestedsites_<suggestedsite.name>[1]. We can use the same name for localized versions of the same site to reuse the same drawable. Other names mean different drawables to be included in the apk.
The TopSites are then made available from SuggestedSites.java through a Cursor.

To be able to localize them we just need each locale package to declare it's own suggestedsites.list in AB_CD/mobile/chrome/region.properties. Any number of them.
Locales can contain just the language or the language-region pair, like we are already using.

I did a small test with different suggestion sites for [en-US](the default), [en-GB] and [ro]. Video
(Images not changed in this video probably because of bug 1500795. After a restart of the app they are showing).

[1] browser.suggestedsites.list.0=facebook will use the android.resource://%s/drawable/suggestedsites_facebook

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.