Skip to content

Fix #6020: Introduce API for surfacing supported audio languages - #6380

Open
Kishan8548 wants to merge 6 commits into
oppia:developfrom
Kishan8548:fix-6020-introduce-supported-audio-languages-api
Open

Fix #6020: Introduce API for surfacing supported audio languages#6380
Kishan8548 wants to merge 6 commits into
oppia:developfrom
Kishan8548:fix-6020-introduce-supported-audio-languages-api

Conversation

@Kishan8548

@Kishan8548 Kishan8548 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Explanation

Fixes #6020
Introduces a getSupportedAudioLanguages() API in TranslationController to correctly surface the list of languages that support audio voiceovers.

Problem: getAudioTranslationContentLocale() and AudioLanguageSelectionViewModel were both using getSupportedAppLanguages() (which filters by hasAppStringId()) to validate audio language selections. This was incorrect — languages like Hinglish have an audio_translation_id but no app_string_id, so they were incorrectly excluded from the supported audio language list and falling back to English.

Changes:

  • Added getSupportedAudioLanguages() to TranslationController filtering by hasAudioTranslationId().
  • Updated getAudioTranslationContentLocale() to use the new API, resolving TODO(#6020).
  • Updated AudioLanguageSelectionViewModel to use getSupportedAudioLanguages(), resolving TODO(#6020).
  • Updated existing test testGetAudioLocale_updateLanguageToHinglish to expect HINGLISH locale (correct behavior) instead of ENGLISH fallback.
  • Added change-detector test verifying HINGLISH is included in the audio language list.

Essential Checklist

  • The PR title starts with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The explanation section above starts with "Fixes #bugnum: " (If this PR fixes part of an issue, use instead: "Fixes 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).

Disclosure of LLM Usage

  • Did you use AI/LLMs when working on this PR? Yes
  • If yes, describe the extent AI was used: Used AI for brainstorming the approach, identifying hasAudioTranslationId() as the correct filter, debugging the existing HINGLISH fallback test failure, and code review assistance.

Fixes oppia#6020
- Added getSupportedAudioLanguages() to TranslationController that
  filters language definitions by hasAudioTranslationId() instead of
  hasAppStringId(), correctly surfacing languages like Hinglish which
  support audio voiceovers but not app strings.
- Updated getAudioTranslationContentLocale() to use the new API,
  resolving TODO(oppia#6020).
- Updated AudioLanguageSelectionViewModel to use getSupportedAudioLanguages(),
  resolving TODO(oppia#6020).
- Updated testGetAudioLocale_updateLanguageToHinglish test to expect
  HINGLISH (correct behavior) instead of ENGLISH fallback.
- Added unit test verifying HINGLISH is included in audio languages.
@Kishan8548 Kishan8548 changed the title Introduce getSupportedAudioLanguages() API in TranslationController Fix #6020: Introduce API for surfacing supported audio languages Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Results

Number of files assessed: 2
Overall Coverage: 92.61%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
TranslationController.ktdomain/src/main/java/org/oppia/android/domain/translation/TranslationController.kt
92.61% 163 / 176 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
AudioLanguageSelectionViewModel.ktapp/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt
This file is exempted from having a test file; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

@Kishan8548
Kishan8548 marked this pull request as ready for review August 27, 2026 15:23
@Kishan8548
Kishan8548 requested a review from a team as a code owner August 27, 2026 15:23
Copilot AI lite review requested due to automatic review settings August 27, 2026 15:23
@Kishan8548
Kishan8548 requested a review from a team as a code owner August 27, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Introduces a dedicated API to expose supported audio voiceover languages (distinct from app-string languages), and updates audio locale resolution + UI selection to use it so languages like Hinglish no longer fall back to English.

Changes:

  • Added getSupportedAudioLanguages() to TranslationController filtering by hasAudioTranslationId().
  • Updated audio translation locale resolution and the audio language selection ViewModel to use the new API.
  • Updated/added tests to assert Hinglish is included and correctly selected for audio.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
domain/src/main/java/org/oppia/android/domain/translation/TranslationController.kt Adds supported-audio-languages provider and uses it for audio content locale resolution.
app/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt Switches supported audio language list source from app languages to audio languages.
domain/src/test/java/org/oppia/android/domain/translation/TranslationControllerTest.kt Updates Hinglish expectation + adds change-detector coverage for audio languages list.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

@Kishan8548 this PR is being marked as draft because the PR description must contain 'Fixes #' or 'Fixes part of #' for each issue the PR is changing, and each one on its own line with no other text.

@github-actions
github-actions Bot marked this pull request as draft August 27, 2026 15:48
@Kishan8548
Kishan8548 marked this pull request as ready for review August 27, 2026 15:56
- Renamed lambda parameter supportedAppLanguages -> supportedAudioLanguages
  in getAudioTranslationContentLocale() since getSupportedAudioLanguages()
  is now passed (not getSupportedAppLanguages()).
- Renamed SUPPORTED_AUDIO_LANGUAGES_DATA_PROVIDER_ID ->
  SUPPORTED_AUDIO_LANGUAGES_COMBINATION_ID to clearly distinguish the
  combineWith key from the list provider ID.
@Kishan8548

Copy link
Copy Markdown
Collaborator Author

@adhiamboperes PTAL . The changes are ready for review. The remaining CI failure appears to be related to the coverage report artifact, not the code changes.

@oppiabot oppiabot Bot assigned adhiamboperes and unassigned Kishan8548 Aug 28, 2026
@oppiabot

oppiabot Bot commented Aug 28, 2026

Copy link
Copy Markdown

Unassigning @Kishan8548 since a re-review was requested. @Kishan8548, please make sure you have addressed all review comments. Thanks!

@adhiamboperes

Copy link
Copy Markdown
Contributor

Assigning @Neer-rn for a first pass.

@Neer-rn Neer-rn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @Kishan8548. Great work I just had few comments, please address them otherwise this PR looks great to me.

@oppiabot oppiabot Bot unassigned Neer-rn Aug 29, 2026
@oppiabot

oppiabot Bot commented Aug 29, 2026

Copy link
Copy Markdown

Unassigning @Neer-rn since the review is done.

@oppiabot

oppiabot Bot commented Aug 29, 2026

Copy link
Copy Markdown

Hi @Kishan8548, it looks like some changes were requested on this pull request by @Neer-rn. PTAL. Thanks!

@Kishan8548

Copy link
Copy Markdown
Collaborator Author

@Neer-rn Addressed the review comments. PTAL.

@oppiabot

oppiabot Bot commented Aug 30, 2026

Copy link
Copy Markdown

Unassigning @Kishan8548 since a re-review was requested. @Kishan8548, please make sure you have addressed all review comments. Thanks!

@Neer-rn Neer-rn self-assigned this Aug 30, 2026

@Neer-rn Neer-rn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have no issue with the code, I think work is done here but the CI keeps failing PTAL and make sure the CI goes green.

@Neer-rn Neer-rn assigned Kishan8548 and unassigned Neer-rn Aug 30, 2026
@Kishan8548

Copy link
Copy Markdown
Collaborator Author

Hi @Neer-rn,

Thanks! The single test failure was actually the GitHub Actions runner hitting an OOM/timeout limit (Bazel caught terminate signal) during the DexMerger step of //instrumentation:oppia_test.

Since it's an infrastructure flake unrelated to these code changes, I've just forced the CI to re-run. Hopefully, the runner gets through it this time!

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Results

Number of files assessed: 11
Overall Coverage: 95.81%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
EdgeToEdgeHelper.ktapp/src/main/java/org/oppia/android/app/utility/edgetoedge/EdgeToEdgeHelper.kt
96.85% 246 / 254 70%
TranslationController.ktdomain/src/main/java/org/oppia/android/domain/translation/TranslationController.kt
94.32% 166 / 176 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
SurveyWelcomeDialogFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/survey/SurveyWelcomeDialogFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
SurveyOutroDialogFragment.ktapp/src/main/java/org/oppia/android/app/survey/SurveyOutroDialogFragment.kt
This file is exempted from having a test file; skipping coverage check.
SurveyWelcomeDialogFragment.ktapp/src/main/java/org/oppia/android/app/survey/SurveyWelcomeDialogFragment.kt
This file is exempted from having a test file; skipping coverage check.
SurveyOutroDialogFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/survey/SurveyOutroDialogFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
HintsAndSolutionDialogFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
HintsAndSolutionDialogFragment.ktapp/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragment.kt
This file is exempted from having a test file; skipping coverage check.
AudioLanguageSelectionViewModel.ktapp/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt
This file is exempted from having a test file; skipping coverage check.
ConceptCardFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
ConceptCardFragment.ktapp/src/main/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

@Kishan8548

Copy link
Copy Markdown
Collaborator Author

@adhiamboperes First pass review is done. PTAL for final review, thanks!

@oppiabot oppiabot Bot assigned adhiamboperes and unassigned Kishan8548 Aug 31, 2026
@oppiabot

oppiabot Bot commented Aug 31, 2026

Copy link
Copy Markdown

Unassigning @Kishan8548 since a re-review was requested. @Kishan8548, please make sure you have addressed all review comments. Thanks!

@Neer-rn Neer-rn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!! Looks like the CI is green. Everything looks clean to me. @adhiamboperes PTAL

@adhiamboperes

Copy link
Copy Markdown
Contributor

Will review this later today.

@adhiamboperes adhiamboperes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Kishan8548! I left a minor comment inline.

Can you test the changes in the UI? You can enable the onboarding flow v2 feature flag via the dev options menu in the app, and test the audio language selection menu during both onboarding and from the options menu.

It is a good sign that the regression tests are not failing, but also manually double checking is great, plus it lets you explore more areas of the app.

Comment on lines +1190 to +1194
// HINGLISH is now a supported audio language (it has audio_translation_id), so it correctly
// resolves to HINGLISH rather than falling back to ENGLISH.
assertThat(context.languageDefinition.language).isEqualTo(HINGLISH)
// This region comes from the default locale.
assertThat(context.regionDefinition.region).isEqualTo(REGION_UNSPECIFIED)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is fine to remove the comments. Anyone reading this in future will most likely not know that hinglish was previously unsupported. You can move this information to the PR body instead, as it will support future debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Introduce API for Surfacing Supported Audio Languages

4 participants