-
Notifications
You must be signed in to change notification settings - Fork 639
Fix #6020: Introduce API for surfacing supported audio languages #6380
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
Open
Kishan8548
wants to merge
6
commits into
oppia:develop
Choose a base branch
from
Kishan8548:fix-6020-introduce-supported-audio-languages-api
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a654646
Introduce getSupportedAudioLanguages() API in TranslationController
Kishan8548 f0d9157
Trigger CI re-run
Kishan8548 71153cc
Rename misleading lambda param and combine key constant for clarity
Kishan8548 af44f1f
Trigger CI re-run
Kishan8548 f8466bc
Address review comments: revert provider ID name and add Portuguese f…
Kishan8548 a83af2c
Trigger CI re-run
Kishan8548 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1178,7 +1178,7 @@ class TranslationControllerTest { | |
| } | ||
|
|
||
| @Test | ||
| fun testGetAudioLocale_updateLanguageToHinglish_returnsEnglishLocale() { | ||
| fun testGetAudioLocale_updateLanguageToHinglish_returnsHinglishLocale() { | ||
|
Neer-rn marked this conversation as resolved.
|
||
| forceDefaultLocale(Locale.ROOT) | ||
| ensureAudioTranslationsLanguageIsUpdatedTo(PROFILE_ID_0, HINGLISH) | ||
|
|
||
|
|
@@ -1187,6 +1187,25 @@ class TranslationControllerTest { | |
| val locale = monitorFactory.waitForNextSuccessfulResult(localeProvider) | ||
| val context = locale.localeContext | ||
| assertThat(context.usageMode).isEqualTo(AUDIO_TRANSLATIONS) | ||
| // 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) | ||
|
Comment on lines
+1190
to
+1194
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| } | ||
|
|
||
| @Test | ||
| fun testGetAudioLocale_updateLanguageToPortuguese_returnsEnglishLocale() { | ||
| forceDefaultLocale(Locale.ROOT) | ||
| ensureAudioTranslationsLanguageIsUpdatedTo(PROFILE_ID_0, PORTUGUESE) | ||
|
|
||
| val localeProvider = translationController.getAudioTranslationContentLocale(PROFILE_ID_0) | ||
|
|
||
| val locale = monitorFactory.waitForNextSuccessfulResult(localeProvider) | ||
| val context = locale.localeContext | ||
| assertThat(context.usageMode).isEqualTo(AUDIO_TRANSLATIONS) | ||
| // PORTUGUESE does not have an audio_translation_id, so it is unsupported for audio translations. | ||
| // Therefore, it should fall back to ENGLISH. | ||
| assertThat(context.languageDefinition.language).isEqualTo(ENGLISH) | ||
| // This region comes from the default locale. | ||
| assertThat(context.regionDefinition.region).isEqualTo(REGION_UNSPECIFIED) | ||
|
|
@@ -2036,6 +2055,20 @@ class TranslationControllerTest { | |
| .containsExactly(ARABIC, ENGLISH, HINDI, BRAZILIAN_PORTUGUESE, SWAHILI, NIGERIAN_PIDGIN) | ||
| } | ||
|
|
||
| @Test | ||
| fun testGetSupportedAudioLanguages_returnsAudioLanguageDefinitions() { | ||
| val languageListProvider = translationController.getSupportedAudioLanguages() | ||
| val languageListData = monitorFactory.waitForNextSuccessfulResult(languageListProvider) | ||
|
|
||
| // Audio languages include HINGLISH which has an audio_translation_id but no app_string_id, | ||
| // so it correctly appears here but not in getSupportedAppLanguages(). This is a change | ||
| // detector test to ensure the audio language selection system provides exactly the list of | ||
| // intended languages. | ||
| assertThat(languageListData).containsExactly( | ||
| ARABIC, ENGLISH, HINDI, HINGLISH, BRAZILIAN_PORTUGUESE, SWAHILI, NIGERIAN_PIDGIN | ||
| ) | ||
| } | ||
|
|
||
| private fun setUpTestApplicationComponent() { | ||
| ApplicationProvider.getApplicationContext<TestApplication>().inject(this) | ||
| } | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.