This patch adds an observer to UpdateLocaleAction that makes the calls to fetch new language names
and model download sizes when a locale change occurs.
Differential Revision: https://phabricator.services.mozilla.com/D217188
This patch adds logic to better account for pivot languages in non-English apps.
It changes:
* English may be downloaded as a language
* English may be deleted as a language, when it is the only language left
* English now syncs whenever it is downloaded
* Model state is periodically refreshed with Gecko in the Translations middleware
when nothing is processing
Differential Revision: https://phabricator.services.mozilla.com/D214638
When a page change happens, the translations engine stops working on the
translation. This new state needs to be reflected in the browser store.
To do this:
* Added `SetTranslateProcessingAction` to change `isTranslateProcessing`
* Added `onTranslatePageChange`` that is notified at onLocationChange
* `onTranslatePageChange` calls `SetTranslateProcessingAction` and requests
the state be set to false
Differential Revision: https://phabricator.services.mozilla.com/D213606
Right now, when an error occurs when downloading or deleting a translations model,
there is nothing to indicate which model had an error.
This patch introduces `ERROR_DELETION` and `ERROR_DOWNLOAD` to indicate state.
Differential Revision: https://phabricator.services.mozilla.com/D213459
`updateTheContentState` and `updateContentState` are the same function. We should refactor the original function
`updateContentState` to be an `internal` function so that we can remove the reductant `updateTheContentState`.
Differential Revision: https://phabricator.services.mozilla.com/D212889
Most calls under `OperationRequestedAction` do not require a tabId because they change
information on the global store and not the session store.
* This patch makes `tabId` an optional for `OperationRequestedAction`
* For the one call, `FETCH_PAGE_LANGUAGES`, that does require a tabId a
sensible default of the current tab will be used and a warning will be logged.
Depends on D210562
Differential Revision: https://phabricator.services.mozilla.com/D210954
In bug 1892715 the wait states for translations changed; however,
`isTranslateProcessing` logic did not change. This is to fix `isTranslateProcessing`
to use the longer wait state.
Differential Revision: https://phabricator.services.mozilla.com/D211439
This patch adds AC changes to allow translation language models to be downloaded
and deleted. Including:
* Adds `ManageLanguageModelsAction` to request changes to language models.
* Adds to the translations state reducer to accommodate state changes when updating.
* Adds `ModelState` to `LanguageModel` in order to capture processing states.
* Adds `ModelUpdateError` as a general area for when the action fails on the engine.
Differential Revision: https://phabricator.services.mozilla.com/D210562
This patch updates Android Components to use the new `hasVisibleChange `
information from the translations engine to better manage translations visible state.
Differential Revision: https://phabricator.services.mozilla.com/D209577
- This refactors `getProperUrl` that was introduced in https://github.com/mozilla-mobile/fenix/pull/16181 into an extension function that lives in AC.
- This function will fetch the correct URL to be used when handling features such as bookmarks or share regardless of what mode the browser might be in (e.g. Reader mode).
Differential Revision: https://phabricator.services.mozilla.com/D208215
This patch adds the option to update the user's language settings from a global perspective.
* Adds `TranslationsAction.UpdateLanguageSettingsAction` to update the language setting.
* `TranslationsStateReducer` proactively accepts updates and is set on the translations engine or else the state is rolled back in `TranslationsMiddleware`.
* Refactors `updateLanguageSetting` in `TranslationsMiddleware` to handle both the page setting and global setting perspective.
Differential Revision: https://phabricator.services.mozilla.com/D208755
Right now, it is only possible to access the “offer to translate” setting off of page settings. Unlike most of the other page settings, this setting is also a global setting.
This patch adds an option to view this setting independently of page settings and helps keep it in sync, when page settings change this setting as well.
We need this because it will soon be possible to access the global settings layer of settings directly via the main menu settings.
This patch:
* Adds `SetGlobalOfferTranslateSettingAction` - Sets the `offerTranslation` value on the global `TranslationsBrowserState`. Intended for global usage.
* Adds `UpdateGlobalOfferTranslateSettingAction` - A global way to update the offer to translate value outside of a page.
* Adds `TranslationOperation.FETCH_OFFER_SETTING` - The same as `SetGlobalOfferTranslateSettingAction`, but for a tab. Intended for tab usage.
* Adds a call to set `offerTranslation` on `Init`
Differential Revision: https://phabricator.services.mozilla.com/D208233
This patch makes a few modifications:
* Migrates `TranslationsState.neverTranslateSites` (session) to `TranslationsBrowserState.neverTranslateSites` (global browser)
* Behavior change: Can no longer update page settings when this list changes, because we have limited info on the session.
* Fetches `neverTranslateSites` information initially on app startup.
Differential Revision: https://phabricator.services.mozilla.com/D208031
This patch fixes showing the Couldn't Load Languages translation error.
Part 1 of this series ensures the translations engine re-queries the language.
This patch:
* Fixes a `var` v. `val` recommendation
* Reorganized error handling
* Session errors have priority over browser errors
* Ensures null errors are also sent to clear state
* Proactively requests languages again when the dialog reopens and ensures error state
Differential Revision: https://phabricator.services.mozilla.com/D205473
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.)
This bug adds:
* When `TranslateExpectedAction` occurs, then calculate the expected
translations model download size.
More background: `TranslateExpectedAction` indicates we have a default
`from` (page language) and a default `to` (user preferred) language
to initialize the translations dialog with expected values.
This queries how large of a download the translation
pair will be eagerly, so we have an initial value for the default recommendation.
This bugs shifts around the initialization for the global store in translations.
Revised Flow:
* `InitAction` -> `InitTranslationsBrowserState`
* `InitTranslationsBrowserState`:
* Checks the engine support, if everything is in order, then finishes initialization on `initializeBrowserStore`.
* 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.