tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 198fa84fad7afc56fa617408cc5bb385e42eb792
parent 71b1ae67929f7ed52743d43417540e85b7751c1f
Author: Erik Nordin <enordin@mozilla.com>
Date:   Sat, 18 Oct 2025 02:16:50 +0000

Bug 1967758 - Return cached identified languages r=translations-reviewers,gregtatum

This patch updates the Translations logic to always try to return
cached language identifiers whenever relevant, instead of making
redundant queries for language identification.

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

Diffstat:
Mtoolkit/components/translations/actors/TranslationsParent.sys.mjs | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/toolkit/components/translations/actors/TranslationsParent.sys.mjs b/toolkit/components/translations/actors/TranslationsParent.sys.mjs @@ -3473,6 +3473,10 @@ export class TranslationsParent extends JSWindowActorParent { * @returns {Promise<DetectionResult>} */ async queryIdentifyLanguage() { + if (this.languageState?.detectedLanguages?.identified) { + return this.languageState.detectedLanguages.identified; + } + return this.sendQuery("Translations:IdentifyLanguage").catch(error => { if (this.#isDestroyed) { // The actor was destroyed while this message was still being resolved.