Closed Bug 1580092 Opened 3 months ago Closed 3 months ago

[ca-valencia] Search engine setup for Firefox for Catalan (Valencian)

Categories

(Firefox :: Search, task)

task
Not set

Tracking

()

RESOLVED FIXED
Firefox 71
Tracking Status
firefox71 --- fixed

People

(Reporter: flod, Assigned: flod)

References

Details

Attachments

(1 file)

We want to copy the values from the current 'ca' locale, at least as a start.

I'm trying to write a patch, but so much has changed, and I'm really confused by engines.json. Example:

"included": {
    "locales": { "matches": ["br", "fr", "wo"] },
    "regions": ["ca"]
},
"webExtensionLocale": "ca"

Why are regions lowercase? More important, why is a region code (CA for Canada) used in a field called webExtensionLocale?

I'm trying to clone the settings for "ca" (Catalan) to "ca-valencia". Is there anything I should update beyond the two JSON files, and the _locales folders inside individual webextensions?

Flags: needinfo?(dharvey)

Why are regions lowercase?

The regions are lowercase because thats how they came from
https://searchfox.org/mozilla-central/source/toolkit/components/mozintl/mozIntl.jsm#176

Maybe its something we should normalise as lowercase when checking but use uppercase in the configation? its definitely been confusing when I couldnt tell which is a locale vs region, but that the same time nice to avoid processing text since we arent using icu or anything to check equality

More important, why is a region code (CA for Canada) used in a field called webExtensionLocale?

We (ab)use the web extension localisation mechanism to distringuish between things that are not necesarrily locales (see https://searchfox.org/mozilla-central/source/browser/components/search/extensions/google/_locales), with the new configuration (engines.json) we are hopeing to move away from that

I'm trying to clone the settings for "ca" (Catalan) to "ca-valencia". Is there anything I should update beyond the two JSON files, and the _locales folders inside individual webextensions?

Nope that should be good, will comment further on phabricator

Flags: needinfo?(dharvey)

(In reply to Dale Harvey (:daleharvey) from comment #3)

The regions are lowercase because thats how they came from
https://searchfox.org/mozilla-central/source/toolkit/components/mozintl/mozIntl.jsm#176

Ugh. Unless I'm missing something obvious, that doesn't look right. I'll check with zibi and jfkthame

Maybe its something we should normalise as lowercase when checking but use uppercase in the configation?

I think that would help. I was unlucky to pick Catalan (ca), but I assume there might be other cases.

We (ab)use the web extension localisation mechanism to distringuish between things that are not necesarrily locales (see https://searchfox.org/mozilla-central/source/browser/components/search/extensions/google/_locales), with the new configuration (engines.json) we are hopeing to move away from that

OK, I'll keep an eye out. I will probably reach out in the future, since I need to update our internal documentation.

The regions are lowercase because thats how they came from
https://searchfox.org/mozilla-central/source/toolkit/components/mozintl/mozIntl.jsm#176

What do you mean "they came from"? This is a list of IDs of region codes.

If you have a field called "region", its value can be in any case, since it is clear that it is a region. If you try to encode a CLDR language identifier (or BCP47 language tag), then you cannot use only the region, it must be preceded by a language to be a valid identifier, for example "und-CA" or "und-FR".

So, from my shallow read, the list of "locales" must conform to BCP47 or CLDR Language Identifier rules, so "ca" is Catalan since it takes the first subtag (language) which can be a two-alpha code.

In the regions list, ca is a region name according to ISO3166-1 2-alpha list - Canada [1].

The example:

"included": {
    "locales": { "matches": ["br", "fr", "wo"] },
    "regions": ["ca"]
},
"webExtensionLocale": "ca"

states that the locales match three languages br (Breton), fr (French) and wo (Wolof), and region is a single item list with a region ca (Canada) [1].

Then, the second field lists a webExtensionLocale, which is ca and that parses to language Catalan.

If that was not the intention, I believe the naming scheme should be updated, or the values should be matching the standards.

[0] https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
[1] https://en.wikipedia.org/wiki/ISO_3166-1

(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #5)

Then, the second field lists a webExtensionLocale, which is ca and that parses to language Catalan.

If that was not the intention, I believe the naming scheme should be updated, or the values should be matching the standards.

At the moment, we've maintained the naming of extensions & locales to be consistent with what it was previously (as things like ABSearch make changing them really difficult). Once we're completely on the new modern configuration, we'll have more flexibility, and we should be able to make improvements.

Pushed by flodolo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fdb95b58fb6c
[ca-valencia] Search engine setup for Firefox for Catalan (Valencian) r=daleharvey

Sorry, I ran the xpcshell/mochitest locally, but didn't think of duplicates. Looking into removing the duplicate alltogether.

Flags: needinfo?(francesco.lodolo)
Pushed by flodolo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bf28d9a8dc77
[ca-valencia] Search engine setup for Firefox for Catalan (Valencian) r=daleharvey
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 71
You need to log in before you can comment on or make changes to this bug.