commit b8789659ea64b4a321d5c721c837d1d82b4894bc
parent 0d69cda9f254c936ec5b8e915ae23fc88d9ac7c0
Author: Erik Nordin <enordin@mozilla.com>
Date: Wed, 22 Oct 2025 16:50:27 +0000
Bug 1995316 - Improve Translations language-id logging r=translations-reviewers,gregtatum
This patch contains miscellaneous fixes and improvements
to the logging around language-identification for translations.
Differential Revision: https://phabricator.services.mozilla.com/D269236
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/toolkit/components/translations/actors/TranslationsParent.sys.mjs b/toolkit/components/translations/actors/TranslationsParent.sys.mjs
@@ -819,7 +819,7 @@ export class TranslationsParent extends JSWindowActorParent {
detectedLanguages.userLangTag
)
) {
- lazy.console.error(
+ lazy.console.log(
"maybeOfferTranslations - The document and user lang tag are the same, not offering a translation.",
documentURI?.spec
);
@@ -3592,13 +3592,19 @@ export class TranslationsParent extends JSWindowActorParent {
return { language: "", confident: false, languages: [] };
}
- const message = `Identified page language as "${result.language}": ${this.browsingContext?.currentURI?.spec}`;
+ const message =
+ `Identified page language as "${result.language}" ` +
+ `in ${((ChromeUtils.now() - startTime) / 1000).toFixed(3)} seconds: ` +
+ this.browsingContext?.currentURI?.spec;
+
ChromeUtils.addProfilerMarker(
"TranslationsParent",
{ startTime, innerWindowId: this.innerWindowId },
message
);
- lazy.console.debug(message);
+
+ lazy.console.debug("\nExtracted Page Text:\n\n", pageText);
+ lazy.console.log(message);
if (pageText.length < TranslationsParent.#DOC_CONFIDENCE_THRESHOLD) {
result.confident = false;