This patch adds functionality for fetching global language settings for
translations.
This patch adds:
* The Operation `FETCH_AUTOMATIC_LANGUAGE_SETTINGS` for fetching the global language
settings from the translation engine.
* `SetLanguageSettingsAction` to set the `languageSettings` on `TranslationsBrowserState`.
*Initialization occurs in `initializeBrowserStore'
* Updates page settings to call `FETCH_AUTOMATIC_LANGUAGE_SETTINGS` after a page level
language update. (These settings coordinate both globally and on a page level.)
* A subtle bug was introduced when page settings were moved from `val` to
`var` for updating page settings.
* Everything works as expected with the reducer updating etc., however
changes on page settings are not observed in compose.
This patch adds a helper for converting BCP 47 codes to translations
supported languages.
Adds:
* `toLanguageMap` - maps a map of BCP 47 code (key) to Language (value)
* `findLanguage` - finds a language using the `toLanguageMap`
* `mapLanguageSettings` - makes a new display ready map for converting
the language settings from Map<String, LanguageSetting>?) to Map<Language?, LanguageSetting>
This patch adds a flow for determining the download size that would
occur for a given translation. Expected use case is for low-data modes.
* New `FetchTranslationDownloadSizeAction`
* New `SetTranslationDownloadSizeAction`
* New `CouldNotDetermineDownloadSizeError`
* New `TranslationDownloadSize` object and `translationDownloadSize` on the
session `TranslationsState`
This patch supports the workflow for checking if the device architecture supports translations.
This patch adds:
* New `TranslationsBrowserState` to hold global translations engine state
* New `SetEngineSupportedAction` to set the isEngineSupported value on `TranslationsBrowserState`
* New `EngineExceptionAction` to set errors on `TranslationsBrowserState`
The goal of this bug is to have a way to update page settings.
It adds:
* A new action, `UpdatePageSettingAction`
* This action has four options:
* `UPDATE_ALWAYS_OFFER_POPUP`
* `UPDATE_ALWAYS_TRANSLATE_LANGUAGE`
* `UPDATE_NEVER_TRANSLATE_LANGUAGE`
* `UPDATE_NEVER_TRANSLATE_SITE`
* Each operation eagerly sets the new setting on the browser store, then
sends the request to the engine. If setting on the engine fails, then
they will re-request the page settings in order to remain in-sync.
This patch refactors a few things for fetching supported languages:
* `TranslateExpectedAction` is decoupled from fetching languages
* Now use `OperationRequestedAction` w/ `FETCH_SUPPORTED_LANGUAGES`
* Refactors the Fenix fragment to send `OperationRequestedAction` as a
placeholder for data initialization
* `TranslateSetLanguagesAction` is now `SetSupportedLanguagesAction`
This patch adds two new Actions:
* `OperationRequestedAction` - for requesting to fetch data
* `SetSettingsAction` - for setting that data on the browser store
`TranslationsMiddleware` reacts to these Actions by fetching and setting
the appropriate data.
The patch to update data will be bug 1877203.
This patch adds the additional state information of `supportedLanguages` and `translationError` to `TranslationsState`. The `supportedLanguages` are the languages the translation engine supports for translating for use in UI dropdowns. `translationError` is any error that occurred relating to translating.
`supportedLanguages` is currently set via an action that indicates the intention to translate on the new `EngineMiddleware` addition of `TranslationsMiddleware`. This patch also adds a new `TranslationOperation` of `FETCH_TO_AND_FROM_LANGUAGES` to indicate the process of getting `supportedLanguages`.
`translationError` is added to the `TranslationsState` to store errors as they arise. `TranslateExceptionAction` is also refactored from using the generic `Throwable` to the new `TranslationError` to accommodate `supportedLanguages` and better general error handling.O_AND_FROM_LANGUAGES` to indicate the process of getting `supportedLanguages`.
This bug adds `TranslationsRuntime.getNeverTranslateSiteList` and
`TranslationsRuntime.setNeverTranslateSpecifiedSite`
for use when managing the global never translate sites list.
Please continue to use `EngineSession.getNeverTranslateSiteSetting`
and `EngineSession.setNeverTranslateSiteSetting` when modifying this
same preference on the currently displayed site.
This bug adds a few options for translations preferences on the engine,
including:
* (Runtime Setting) Option to get/set translations offer popup
* (Runtime Request) Option to get/set translation language preference
* (Session Request) Option to get/set a site's translation preference
This bug adds a translation session delegate for receiving information
from GeckoView on the state of the toolkit translation engine and also
when to expect and offer translations on a given page.
It also updates reference browser to use auto-detected defaults for
translating.