Bug 1490444 - Localization should register its observers. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D5574

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2018-09-11 23:40:39 +00:00
parent d43f067572
commit 164b059344
3 changed files with 8 additions and 0 deletions

View File

@ -65,6 +65,12 @@ DocumentL10n::Init(nsTArray<nsString>& aResourceIds)
// is ready for localization.
uint32_t ret;
mDOMLocalization->AddResourceIds(aResourceIds, true, &ret);
// Register observers for this instance of
// mozDOMLocalization to allow it to retranslate
// the document when locale changes or pseudolocalization
// gets turned on.
mDOMLocalization->RegisterObservers();
return true;
}

View File

@ -14,6 +14,7 @@ interface mozIDOMLocalization : nsISupports
{
unsigned long addResourceIds(in Array<AString> resourceIds, in bool aEager);
unsigned long removeResourceIds(in Array<AString> resourceIds);
void registerObservers();
Promise formatMessages(in Array<jsval> aKeys);
Promise formatValues(in Array<jsval> aKeys);

View File

@ -27,6 +27,7 @@ L10nRegistry.registerSource(source);
add_task(function test_methods_presence() {
equal(typeof domLocalization.addResourceIds, "function");
equal(typeof domLocalization.removeResourceIds, "function");
equal(typeof domLocalization.registerObservers, "function");
equal(typeof domLocalization.formatMessages, "function");
equal(typeof domLocalization.formatValues, "function");