Closed Bug 1337551 Opened 7 years ago Closed 7 years ago

Migrate Services.jsm to use LocaleService


(Core :: Internationalization, defect)

Not set



Tracking Status
firefox54 --- fixed


(Reporter: zbraniecki, Assigned: zbraniecki)




(1 file)

      No description provided.
Depends on: 1308329
Assignee: nobody → gandalf
Comment on attachment 8843118 [details]
Bug 1337551: Migrate Services.jsm to use LocaleService.

triggered around 500 errors. Let's fix them before requesting review.
Attachment #8843118 - Flags: review?(jfkthame)
> triggered around 500 errors.

Update, triggered 500 errors with just a few mistyped characters. (didn't return from a function).

:mossop - this should work now (launched a try) and it moves Services.locale to use LocaleService which seems appropriate and is part of the unifying theme of getting all callsites that are trying to get the app locale call one API.
Comment on attachment 8843118 [details]
Bug 1337551: Migrate Services.jsm to use LocaleService.
Attachment #8843118 - Flags: review?(dtownsend) → review+
I had to limit the scope of this bug because of bug 1344445. It's still fortunately possible to migrate the Services.locale.
Comment on attachment 8843118 [details]
Bug 1337551: Migrate Services.jsm to use LocaleService.

A couple of minor drive-by comments....

::: addon-sdk/source/test/test-l10n-locale.js:113
(Diff revision 5)
> -  let expectedLocale = Services.locale.getLocaleComponentForUserAgent().
> +  let expectedLocale = Services.locale.getAppLocale().
>      toLowerCase();

Might be nice to un-wrap this line now that it's so much shorter.

::: browser/modules/DirectoryLinksProvider.jsm:212
(Diff revision 5)
>            this._setDefaultEnhanced();
>            break;
>          case this._observedPrefs.linksURL:
>            delete this.__linksURL;
>            // fallthrough

There's nothing for this to "fallthrough" to any more... suggest removing this comment, and adding `break` for clarity.

::: browser/modules/DirectoryLinksProvider.jsm:214
(Diff revision 5)
> -        case this._observedPrefs.matchOSLocale:
> -        case this._observedPrefs.prefSelectedLocale:
> -          this._fetchAndCacheLinksIfNecessary(true);
> -          break;
>        }
> +    } else if (aTopic === "intl:app-locales-changed") {

The previous `if (aTopic...` test used `==`, this one uses `===`. Consistency is good...
Ugh, I had to revert more of the patch because the tests for the behavior are pretty complicated. I want to just move `Services.locale` in this, bug and deal with all callsites to `general.useragent.locale` later.
Pushed by
Migrate Services.jsm to use LocaleService. r=mossop
Ok, the try is green. It seems like many cleanups I wanted to do in this bug will require bug 1344445 to be resolved, so this is much smaller, but it does transition Services.locale to use mozILocaleService.
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
I did introduce a minor regression (in a very obscure codepath - matchOS scenario), that I'm fixing in bug 1344901.
Depends on: 1344978
Depends on: 1344901
No longer depends on: 1344978
Depends on: 1344727
Depends on: 1395355
You need to log in before you can comment on or make changes to this bug.