feat: Support on-device translation in the Google Play Store variant #1731
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On the Play Store variant allow the user to choose how translation should be performed:
To do this:
Put translation functionality behind a new
TranslationService
interface, with different implementations for thegoogle
and non-google builds. The non-google implementation has the current behaviour, thegoogle
build depends on MlKit, and uses it to perform the translation.On all builds show a new preference that allows the user to choose the translation backend to use. On non-google builds this only allows the user to choose "Server only". On
google
builds the user can choose from the other two options.On the
google
build show additional preferences that allow the user to decide whether language packs can be downloaded using mobile data, and manage the available language packs; downloading new ones or deleting existing ones.Provide
TranslationModelManagerFragment
to provide the UI that allows the the user to manage the language packs.If the user changes their preferred language their translation backend preference is reset to "Server only" if MlKit cannot translate to their language.
On-device translation allows direct messages to be translated, which is not possible with server-side translation. Remove the code that special-cased direct message display and allow translation. As a side effect the full range of status menu options (e.g., downloading attachments) are now available on direct messages.