Skip to content
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 #3734, #669: Gate language options behind feature flag, add more patterns, and other miscellaneous alpha MR3 fixes #3797

Conversation

BenHenning
Copy link
Sponsor Member

@BenHenning BenHenning commented Sep 15, 2021

Fix #3734
Fix #669

Explanation

This PR:

  • Gates language selection behind a new feature flag (Language selection screen [Blocked: #20, #44] #52 is tracking introducing a comprehensive UI for language selection; some UX & product considerations are needed before we can build this UI)
  • Adds 4 new regex patterns for various locale-related things that shouldn't be allowed anymore
  • Introduces miscellaneous fixes that were found as needed prior to building the version of MR3 that was tested last week (see below)

New Regex checks

The new checks added prohibit:

  • Using java.util.Calendar
  • Using java.util.Date
  • Using java.util.Locale
  • Using anything from java.text

These packages/components all perform or are used to perform locale-sensitive operations, and their corresponding functionality is now available in a locale-consistent & safe way using MachineLocale and DisplayLocale. The exemptions are either components that must reference these in order to provide their underlying functionality, tests where it's easier to not use OppiaLocale, or cases that didn't need to be migrated now (for these, TODOs were added with newly filed issues: #3791, #3792).

Miscellaneous fixes

  • Adding translations for App and Audio Language selection. #669 was marked as fixed since the goal is to not fetch supported languages from the backend (the app needs to know its exact language set for compatibility). This is now handled through the textproto configuration files & related infrastructure that depends on it.
  • Glide broke when loading images with a Proguard-optimized build on older versions of Android due to older versions of Android depending on reflection within its implementation of java.lang.Enum (so an additional dontoptimize exemption was needed for certain aspects of enums)
  • The version code was updated to encapsulate test releases on the Play Store (we can only use a version code once, and they need to be increasing, so we'll be updating this version code a lot moving forward). Longer-term, we'll leverage automation to manage this version code so that a human doesn't need to do it.
  • The platform parameter module needed to be reworked so that the singleton implementation wasn't provided along with the app's parameters so that certain tests (such as the two OptionsFragmentTest suites updated in this PR) can override feature parameter values. This is the main contributor to the PR's length both in LOC and files affected.

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

Screenshots (language options now missing):

Portrait:
image

Landscape:
image

Note: tablet screenshots not included since this UI change a trivial removal of behavior. Similarly, RTL & Talkback behaviors aren't included since this is just removing an item from the options menu.

Espresso results: OptionsFragmentTest is passing:

OptionsFragmentTest_passing_espresso

BenHenning and others added 30 commits August 31, 2021 23:33
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
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.
@BenHenning
Copy link
Sponsor Member Author

@vinitamurthi @rt4914 @anandwana001 PTAL for codeowners.

@oppiabot
Copy link

oppiabot bot commented Oct 5, 2021

Unassigning @vinitamurthi since they have already approved the PR.

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit query, else all LGTM

@@ -90,6 +103,7 @@ class OptionsFragmentTest {

@Before
fun setUp() {
TestModule.forceEnableLanguageSelectionUi = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we shift this initialization to each test as some require true some false?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sort of lean toward defaulting since it might be easy to miss in future tests. Ideally, we would use annotations to toggle features on/off, but we don't have that support yet so enabling the feature becomes a bit hidden like this.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@rt4914 rt4914 removed their assignment Oct 5, 2021
@oppiabot oppiabot bot added the PR: LGTM label Oct 5, 2021
@oppiabot
Copy link

oppiabot bot commented Oct 5, 2021

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
Base automatically changed from localization-part6-introduce-content-and-answer-translations-support to develop October 6, 2021 21:11
…tions-support' into localization-part7-add-gate-for-selecting-written-language-and-add-todos
@BenHenning
Copy link
Sponsor Member Author

Merging this as-is. @anandwana001 please let me know if you feel strongly about your comment (happy to follow up with a change if needed).

@BenHenning BenHenning changed the title Fix #3734, #669: Gate language options behind feature flag, add more patterns, and other miscellaneous alpha MR3 fixes [Blocked: #3796] Fix #3734, #669: Gate language options behind feature flag, add more patterns, and other miscellaneous alpha MR3 fixes Oct 6, 2021
@BenHenning BenHenning merged commit 0caaa7f into develop Oct 6, 2021
@BenHenning BenHenning deleted the localization-part7-add-gate-for-selecting-written-language-and-add-todos branch October 6, 2021 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable in-lesson language picker Adding translations for App and Audio Language selection.
5 participants