-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #3729, #3730, #3777, #91, #20, part of #3625: Introduce support for localizing lesson content & multi-lingual answer submission #3796
Conversation
There are a lot of details to cover here--see the PR for the complete context.
- Add missing codeowner - Add support for configuring base branch reference - Update CI for dev/alpha AAB builds to use 'develop' since there's no origin configured by default in the workflows
This is needed to open a PR on GitHub. This commit is being made so that the PR can start off in a broken Actions state. This also initially disables most non-Bazel workflows to make workflow iteration faster and less impacting on other team members.
This introduces a new mechanism for passing lists of tests to sharded test targets in CI, and hooks it up. No actual sharding is occurring yet. This led to some simplifications in the CI workflow since the script can be more dynamic in computing the full list of targets (which also works around a previous bug with instrumentation tests being run). Java proto lite also needed to be upgraded for the scripts to be able to use it. More testing/documentation needed as this functionality continues to expand.
This simply partitions bucketed groups of targets into chunks of 10 for each run. Only 3 buckets are currently retained to test sharding in CI before introducing full support.
Fixes some caching bucket and output bugs. Also, introduces while loop & keep_going to introduce resilience against app test build failures (or just test failures in general).
Also, enable other workflows. Note that CI shouldn't fully pass yet since some documentation and testing needs to be added yet, but this is meant to be a more realistic test of the CI environment before the PR is finished.
Adds a human-readable prefix to make the shards look a bit nicer. Also, adds more fine-tuned partitioning to bucket & reduce shard counts to improve overall timing. Will need to be tested in CI.
A newly computed variable wasn't updated to be used in an earlier change.
Add docstrings for proto.
…/oppia-android into add-bundles-proguard-build-flavors
See #3757 (comment) for context.
Neither 'mv -t' nor piping to mv work on OSX so we needed to find an alternative (in this case just trying to move everything). This actually works a bit better since it's doing a per-file move rather than accommodating for files that shouldn't be moved (which isn't an issue since the destination directory is different than the one containing the AAB file).
Documentation, thorough tests, and detailed description of these changes are still needed.
This demonstrates working string selection for system-based and overwritten app languages, including necessary activity recreation & layout direction overwriting. This also includes a bunch of Dagger infra refactoring so that some app layer packages can now be modularized (including the new packages).
…o localization-part5-introduce-app-string-translations-support-and-refactor
This involves MANY broad changes to ensure consistent string retrieval (for arrays and plurals), formatting, and string transformations throughout the codebase. Some extra patterns to added to fix things that were needed, and a few issues were fixed along the way.
@rt4914 PTAL for codeowners @vinitamurthi PTAL for codeowners. Also, while updating QuestionAssessmentProgressControllerTest for correctness some of the mastery values changed. I'm having difficulty determining if the new calculations are actually correct (indicating the old ones were wrong), though from what I can tell they seem correct now. Can you please check & confirm? It's unexpected that these changes would result in a difference--I'm not entirely sure what's going on there. See:
@anandwana001 PTAL for codeowners & also as a second reviewer for domain/utility changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM but I am not sure why the mastery values changed. @TheRealJessicaLi can you take a look at the two tests Ben mentioned?
Unassigning @vinitamurthi since they have already approved the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BenHenning, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
…answer-translations-support Conflicts: domain/BUILD.bazel
Thanks all. @TheRealJessicaLi I followed up with you over chat. To unblock downstream work & the MR4 launch, I'm going ahead and merging this. Please follow up if there's actually a mistake that needs to be fixed here. |
Fix #3729
Fix #3730
Fix #3777
Fix #91
Fix #20
Fix part of #3625
Explanation
This PR introduces the integration pathways necessary for all currently localizable content strings to be properly translated using the infrastructure introduced in #3794. The current localization support per Oppia lesson structures (that are also being introduced in this PR):
Note that some of the above aren't yet supported in Oppia's editor experience, so they aren't actually translated in production assets (concept & revision cards). Further, there are some parts of lesson structures that don't yet support translations (titles, descriptions, and outlines), so the app experience will be partly translated.
Finally, see #3794 for context on the overall design of the infrastructural side of this work, and for a link to the (now outdated) design document for the project.
Design overview
At a high-level, content & related strings (such as answer options or interaction placeholders) are translated by switching out the default content string with a translated version via its content ID using a translation context that's computed by TranslationController (the string swapping bit is also done via convenience helpers from TranslationController). This context is computed to contain the exact strings needed for each situation based on the user's current content language.
To implement the above, the translation context is passed along in all ephemeral structures (i.e.
EphemeralState
andEphemeralQuestion
). Two new ephemeral structures were also added for similar purpose:EphemeralConceptCard
andEphemeralRevisionCard
since translation context is short-lived data and the contained concept/revision cards are persisted. Note that one consequence of this is that all ephemeral structure data providers now depend on various language data providers (including the system data provider) to ensure automatic updating works properly.Users cannot select their content language today (#3797 is disabling the current UI, and #52 will include the work to properly re-enable it). The default content language is to use whatever app strings are using (which is currently to default to the system language), or fall back to the default content strings.
The other part of content localization is supporting non-English answers. Java/Kotlin + Android handle the encoding part automatically, so all the app needs to do is match the answer to the correct corresponding localized answer. Most interactions are either language-agnostic (e.g. fractions, numeric input, ratios) or leverage other indicators like indexes or content IDs to perform matching (e.g. multiple choice, item selection, drag and drop). The only interaction actually needing work is text input. In order for this (& future interactions) to properly localize, the classification framework was updated to also take the current translation context so that the correct input can be picked when matching against the answer.
Note that from a UX perspective, content strings almost always match the exact current language. That means if the user were to change their language mid-lesson, nearly all the strings will update. The single exception is submitted answers since those had a localized meaning at the time of submission, so they retain their translation. All other content strings currently will switch (including feedback).
Other miscellaneous considerations for the design:
Changes to test assets
This PR required updating the structures of all test assets (both JSON & textproto) to support a relatively recent change to localization in explorations. Rule inputs now support content-ID based input types (which, for text input, required support in the translation substructure to support a list of translated strings rather than a single). Unfortunately, it results in multiple thousands of lines of affected changes. Note that most of the JSON & textproto changes are automatically generated by a import/conversion script, so I suggest lightly reviewing those files. Our tests cover the content of the test lessons quite thoroughly at this point, as well.
Beyond that, it was also desirable to translated at least one example of each structure type (except questions) to verify this PR. To do that, the asset download script that we use was updated to support filling in automatic translations by scraping Google Translate on web. Many of the translations may be a bit nonsensical, but they are reasonable placeholders to verify translation functionality for both Arabic & Brazilian Portuguese.
Note that a new subtopic was added for the base test topic so that revision card translations could be tested. I suspect we'll find other good uses out of this new test subtopic, as well.
Finally, the changes to the proto structures were meant to be backward compatible with previous saved versions of explorations or saved state (though these aren't expected to realistically hit users other than developers with saved checkpoints, so little effort was made to actually verify the support this time).
Issues fixed in this PR
There were a few issues discovered and/or fixed as part of this PR:
Changes to the core language selection mechanism
This PR also changes the core language selection mechanism to no longer update the application context, also changing the meaning of the system data provider to always be tied to the actual current system locale. This fixes an issue noticed earlier that broke automatic content string updates when the system locale changes, and is actually conceptually more consistent since it ensures the app can always keep track of the actual system locale.
While this improves tracking & fixes the observed issue, it also introduces some new inconsistencies (such as the navigation drawer not updating when the system locale changes). There are a few edge cases where the mechanism breaks down a bit, so more robustness work will be needed in the future. #3840 is partly tracking the infrastructural side of this, but additional user-facing localization issues are likely to be filed in future app test passes.
Misceallaneous changes
Miscellaneous changes in the PR & why they were needed:
Essential Checklist
For UI-specific PRs only
Overview screenshots / video
Since this PR covers multiple screens, these screenshots will cover specific cases of content. Also, a video will be provided at the end demonstrating the app's behavior with automatic selection.
Portrait -- exploration player (English/Arabic):
Landscape -- exploration player (English/Arabic):
Portrait -- revision card (English/Arabic):
Landscape -- revision card (English/Arabic):
Video demonstrating automatic switching between English, Arabic, and Brazilian Portuguese (& other content screens from the above):
https://user-images.githubusercontent.com/12983742/135427506-286ffaad-fa86-4275-b260-02fdfd9afb61.mp4
Note that tablet screenshots are not included since there aren't any layout changes made by this PR.
Accessibility
See video for how Talkback behaves with content string translations:
exploration_player_translated_content_strings_talkback.mp4
(Note that RTL switches properly for Talkback when Arabic is selected)
Espresso tests
Per above, no new Espresso tests were added in this PR. Instead, the following suites were tested against develop & this branch to ensure no regressions were introduced:
All test suites except StateFragmentTest & ExplorationActivityTest passed on both develop & this branch. See the following screenshot for test results on this branch:
For ExplorationActivityTest, I observed the following tests failing on Espresso:
Locally, I noticed the following additional failures (note that some of the above passed for me locally):
All of these came from an instrumentation process crash which seems to be unrelated to this PR.
Regarding StateFragmentTest, I observed the following failures on this branch:
* was observed as failing on develop, plus another test that didn't fail in this run.
Essentially all of these failed due to the TestCoroutineDispatchers idling resource not finishing. While there are some changes in this PR that could affect that (e.g. DataProviderMonitor), they aren't actually being used by Espresso (those tests are disabled), and it oddly only affects some of the tests. This is also the same error for the failed tests on develop, and I don't see a reason why this branch would make it worse.