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 #3384 : Arrange strings file #5252

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
android:value="2020-09-01" />
<activity
android:name=".app.administratorcontrols.AdministratorControlsActivity"
android:label="@string/administrator_controls_title"
android:label="@string/administrator_controls_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.AdministratorControlsFragmentTestActivity"
android:label="@string/administrator_controls_fragment_test_activity_label"
android:label="@string/administrator_controls_fragment_test_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.SpotlightFragmentTestActivity"
Expand Down Expand Up @@ -140,7 +140,7 @@
<activity android:name=".app.player.state.testing.StateFragmentTestActivity" />
<activity
android:name=".app.profile.AddProfileActivity"
android:label="@string/add_profile_activity_label"
android:label="@string/add_profile_activity_title"
android:theme="@style/OppiaThemeWithoutActionBarColorAccentColorPrimary" />
<activity
android:name=".app.profile.AdminAuthActivity"
Expand All @@ -159,7 +159,7 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.ProfileChooserActivity"
android:label="@string/profile_chooser_activity_label"
android:label="@string/profile_chooser_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.profileprogress.ProfilePictureActivity"
Expand Down Expand Up @@ -233,7 +233,7 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.testing.ProfileEditFragmentTestActivity"
android:label="@string/profile_edit_fragment_test_activity_label"
android:label="@string/profile_edit_fragment_test_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity android:name=".app.testing.StateAssemblerMarginBindingAdaptersTestActivity" />
<activity android:name=".app.testing.StateAssemblerPaddingBindingAdaptersTestActivity" />
Expand All @@ -257,7 +257,7 @@
<activity android:name=".app.testing.SplashTestActivity" />
<activity
android:name=".app.topic.TopicActivity"
android:label="@string/topic_page"
android:label="@string/topic_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.walkthrough.WalkthroughActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class AdministratorControlsActivity :
selectedProfileId,
isProfileDeletionDialogVisible
)
title = resourceHandler.getStringInLocale(R.string.administrator_controls)
title = resourceHandler.getStringInLocale(R.string.administrator_controls_activity_title)
}

override fun routeToAppVersion() {
Expand Down Expand Up @@ -146,7 +146,9 @@ class AdministratorControlsActivity :
lastLoadedFragment = PROFILE_LIST_FRAGMENT
administratorControlsActivityPresenter
.setExtraControlsTitle(
resourceHandler.getStringInLocale(R.string.administrator_controls_edit_profiles)
resourceHandler.getStringInLocale(
R.string.administrator_controls_fragment_edit_profiles_text
)
)
administratorControlsActivityPresenter.loadProfileList()
}
Expand All @@ -155,7 +157,7 @@ class AdministratorControlsActivity :
lastLoadedFragment = APP_VERSION_FRAGMENT
administratorControlsActivityPresenter
.setExtraControlsTitle(
resourceHandler.getStringInLocale(R.string.administrator_controls_app_version)
resourceHandler.getStringInLocale(R.string.administrator_controls_fragment_app_version_text)
)
administratorControlsActivityPresenter.loadAppVersion()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ class AdministratorControlsActivityPresenter @Inject constructor(
when (currentFragment) {
is ProfileEditFragment -> {
setExtraControlsTitle(
resourceHandler.getStringInLocale(R.string.administrator_controls_edit_profiles)
resourceHandler.getStringInLocale(
R.string.administrator_controls_fragment_edit_profiles_text
)
)
loadProfileList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class LogoutDialogFragment : InjectableDialogFragment() {

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireContext(), R.style.OppiaAlertDialogTheme)
.setMessage(R.string.log_out_dialog_message)
.setNegativeButton(R.string.log_out_dialog_cancel_button) { dialog, _ ->
.setMessage(R.string.log_out_dialog_message_text)
.setNegativeButton(R.string.log_out_dialog_cancel_button_text) { dialog, _ ->
dialog.dismiss()
}
.setPositiveButton(R.string.log_out_dialog_okay_button) { _, _ ->
.setPositiveButton(R.string.log_out_dialog_okay_button_text) { _, _ ->
val intent = ProfileChooserActivity.createProfileChooserActivity(activity!!)
startActivity(intent)
}.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ class AppVersionViewModel @Inject constructor(

/** Returns a localized, human-readable app version name. */
fun computeVersionNameText(): String =
resourceHandler.getStringInLocaleWithWrapping(R.string.app_version_name, versionName)
resourceHandler.getStringInLocaleWithWrapping(
R.string.app_version_fragment_version_name_text, versionName
)

/** Returns a localized, human-readable lastUpdateDateTime. */
fun computeLastUpdatedDateText(): String =
resourceHandler.getStringInLocaleWithWrapping(
R.string.app_last_update_date, getDateTime(lastUpdateDateTime)
R.string.app_version_fragment_last_update_date_text, getDateTime(lastUpdateDateTime)
)

private fun getDateTime(lastUpdateTime: Long): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ChapterNotStartedContainerConstraintLayout @JvmOverloads constructor(
isSpotlit = true
val spotlightTarget = SpotlightTarget(
this,
resourceHandler.getStringInLocale(R.string.first_chapter_spotlight_hint),
resourceHandler.getStringInLocale(R.string.topic_fragment_first_chapter_spotlight_hint),
feature = Spotlight.FeatureCase.FIRST_CHAPTER
)
if (index == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PromotedStoryCardView @JvmOverloads constructor(
isSpotlit = true
val spotlightTarget = SpotlightTarget(
this,
resourceHandler.getStringInLocale(R.string.promoted_story_spotlight_hint),
resourceHandler.getStringInLocale(R.string.home_story_promoted_story_spotlight_hint),
feature = Spotlight.FeatureCase.PROMOTED_STORIES
)
checkNotNull(getSpotlightManager()).requestSpotlightViewWithDelayedLayout(spotlightTarget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void setProfileDataText(@NonNull TextView textView, long timestamp
AppLanguageResourceHandler resourceHandler = getResourceHandler(textView);
String time = resourceHandler.computeDateString(timestamp);
textView.setText(resourceHandler.getStringInLocaleWithWrapping(
R.string.profile_edit_created,
R.string.profile_edit_activity_created_text,
time
));
}
Expand All @@ -34,7 +34,9 @@ public static void setProfileDataText(@NonNull TextView textView, long timestamp
@BindingAdapter("profile:lastVisited")
public static void setProfileLastVisitedText(@NonNull TextView textView, long timestamp) {
AppLanguageResourceHandler resourceHandler = getResourceHandler(textView);
String profileLastUsed = resourceHandler.getStringInLocale(R.string.profile_last_used);
String profileLastUsed = resourceHandler.getStringInLocale(
R.string.profile_edit_activity_last_used_text
);
String timeAgoTimeStamp = getTimeAgo(textView, timestamp);
String profileLastVisited = resourceHandler.getStringInLocaleWithWrapping(
R.string.profile_last_visited,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ class ExitProfileDialogFragment : InjectableDialogFragment() {
val alertDialog = AlertDialog
.Builder(ContextThemeWrapper(activity as Context, R.style.OppiaAlertDialogTheme))
.setMessage(R.string.home_activity_back_dialog_message)
.setNegativeButton(R.string.home_activity_back_dialog_cancel) { dialog, _ ->
.setNegativeButton(R.string.home_activity_back_dialog_cancel_button) { dialog, _ ->
dialog.dismiss()
}
.setPositiveButton(R.string.home_activity_back_dialog_exit) { _, _ ->
.setPositiveButton(R.string.home_activity_back_dialog_exit_button) { _, _ ->
// TODO(#3641): Investigate on using finish instead of intent.
val intent = ProfileChooserActivity.createProfileChooserActivity(activity!!)
if (!restoreLastCheckedItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ class NavigationDrawerFragmentPresenter @Inject constructor(
fragment.activity,
drawerLayout,
toolbar,
R.string.drawer_open_content_description,
R.string.drawer_close_content_description
R.string.navigation_drawer_fragment_open_content_description,
R.string.navigation_drawer_fragment_close_content_description
) {
override fun onDrawerOpened(drawerView: View) {
super.onDrawerOpened(drawerView)
Expand Down Expand Up @@ -459,8 +459,8 @@ class NavigationDrawerFragmentPresenter @Inject constructor(
fragment.activity,
drawerLayout,
toolbar,
R.string.drawer_open_content_description,
R.string.drawer_close_content_description
R.string.navigation_drawer_fragment_open_content_description,
R.string.navigation_drawer_fragment_close_content_description
) {
override fun onDrawerOpened(drawerView: View) {
super.onDrawerOpened(drawerView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class NavigationDrawerHeaderViewModel @Inject constructor(
)
}

fun getBarSeparator() = resourceHandler.getStringInLocale(R.string.bar_separator)
fun getBarSeparator() = resourceHandler.getStringInLocale(
R.string.navigation_drawer_fragment_bar_separator_text
)

private fun computeProfileTopicProgressText(): String {
return resourceHandler.getQuantityStringInLocaleWithWrapping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class HelpActivity :
selectedLicenseIndex,
policiesActivityParams
)
title = resourceHandler.getStringInLocale(R.string.menu_help)
title = resourceHandler.getStringInLocale(R.string.menu_help_text)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class HelpActivityPresenter @Inject constructor(
when (fragmentTag) {
LICENSE_LIST_FRAGMENT_TAG -> {
val thirdPartyDependenciesList = resourceHandler.getStringInLocale(
R.string.help_activity_third_party_dependencies_list
R.string.help_activity_third_party_dependencies_text
)
activity.findViewById<ImageButton>(R.id.help_multipane_options_back_button)
.contentDescription = resourceHandler.getStringInLocaleWithoutWrapping(
Expand All @@ -291,7 +291,7 @@ class HelpActivityPresenter @Inject constructor(
}
LICENSE_TEXT_FRAGMENT_TAG -> {
val copyrightLicensesList = resourceHandler.getStringInLocale(
R.string.help_activity_copyright_licenses_list
R.string.help_activity_copyright_licenses_text
)
activity.findViewById<ImageButton>(R.id.help_multipane_options_back_button)
.contentDescription = resourceHandler.getStringInLocaleWithoutWrapping(
Expand Down Expand Up @@ -337,10 +337,10 @@ class HelpActivityPresenter @Inject constructor(
private fun selectPoliciesFragment(policyPage: PolicyPage) {
when (policyPage) {
PolicyPage.PRIVACY_POLICY -> setMultipaneContainerTitle(
resourceHandler.getStringInLocale(R.string.privacy_policy_title)
resourceHandler.getStringInLocale(R.string.policy_activity_privacy_policy_title)
)
PolicyPage.TERMS_OF_SERVICE -> setMultipaneContainerTitle(
resourceHandler.getStringInLocale(R.string.terms_of_service_title)
resourceHandler.getStringInLocale(R.string.policy_activity_terms_of_service_title)
)
else -> { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HelpItemViewModel(
) : ObservableViewModel() {
fun onClick(title: String) {
when (title) {
resourceHandler.getStringInLocale(R.string.frequently_asked_questions_FAQ) -> {
resourceHandler.getStringInLocale(R.string.help_activity_faq_text) -> {
if (isMultipane) {
val loadFaqListFragmentListener = activity as LoadFaqListFragmentListener
loadFaqListFragmentListener.loadFaqListFragment()
Expand All @@ -36,10 +36,10 @@ class HelpItemViewModel(
routeToThirdPartyDependencyListListener.onRouteToThirdPartyDependencyList()
}
}
resourceHandler.getStringInLocale(R.string.privacy_policy_title) -> {
resourceHandler.getStringInLocale(R.string.policy_activity_privacy_policy_title) -> {
loadPolicyPage(PolicyPage.PRIVACY_POLICY)
}
resourceHandler.getStringInLocale(R.string.terms_of_service_title) -> {
resourceHandler.getStringInLocale(R.string.policy_activity_terms_of_service_title) -> {
loadPolicyPage(PolicyPage.TERMS_OF_SERVICE)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class HelpListViewModel @Inject constructor(
private fun getRecyclerViewItemList(): ArrayList<HelpItemViewModel> {
for (item in HelpItems.values()) {
val category = when (item) {
HelpItems.FAQ -> resourceHandler.getStringInLocale(R.string.frequently_asked_questions_FAQ)
HelpItems.FAQ -> resourceHandler.getStringInLocale(R.string.help_activity_faq_text)
HelpItems.THIRD_PARTY -> resourceHandler.getStringInLocale(
R.string.third_party_dependency_list_activity_title
)
HelpItems.PRIVACY_POLICY -> resourceHandler.getStringInLocale(
R.string.privacy_policy_title
R.string.policy_activity_privacy_policy_title
)
HelpItems.TERMS_OF_SERVICE -> resourceHandler.getStringInLocale(
R.string.terms_of_service_title
R.string.policy_activity_terms_of_service_title
)
}
arrayList += HelpItemViewModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class FAQListActivityPresenter @Inject constructor(

faqListActivityToolbar = binding.faqListActivityToolbar
activity.setSupportActionBar(faqListActivityToolbar)
activity.supportActionBar!!.title = resourceHandler.getStringInLocale(R.string.FAQs)
activity.supportActionBar!!.title = resourceHandler.getStringInLocale(
R.string.faq_list_activity_title
)
activity.supportActionBar!!.setDisplayShowHomeEnabled(true)
activity.supportActionBar!!.setDisplayHomeAsUpEnabled(true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class FAQSingleActivityPresenter @Inject constructor(

faqSingleActivityToolbar = binding.faqSingleActivityToolbar
activity.setSupportActionBar(faqSingleActivityToolbar)
activity.supportActionBar!!.title = resourceHandler.getStringInLocale(R.string.FAQs)
activity.supportActionBar!!.title = resourceHandler.getStringInLocale(
R.string.faq_list_activity_title
)
activity.supportActionBar!!.setDisplayShowHomeEnabled(true)
activity.supportActionBar!!.setDisplayHomeAsUpEnabled(true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class HintsAndSolutionDialogFragmentPresenter @Inject constructor(
HintsAndSolutionFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
binding.hintsAndSolutionToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp)
binding.hintsAndSolutionToolbar.setNavigationContentDescription(
R.string.hints_and_solution_close_icon_description
R.string.hint_solution_dialog_close_icon_description
)
binding.hintsAndSolutionToolbar.setNavigationOnClickListener {
(fragment.requireActivity() as? HintsAndSolutionListener)?.dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class HintsAndSolutionViewModel private constructor(
): HintViewModel {
return HintViewModel(
title = resourceHandler.getStringInLocaleWithWrapping(
R.string.hint_list_item_number,
R.string.hint_solution_dialog_hint_list_item_number,
resourceHandler.toHumanReadableString(hintIndex + 1)
),
hintSummary = translationController.extractString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,22 @@ class RevealSolutionDialogFragment : InjectableDialogFragment() {

return AlertDialog
.Builder(ContextThemeWrapper(activity as Context, R.style.OppiaDialogFragmentTheme))
.setTitle(R.string.reveal_solution)
.setTitle(R.string.hint_solution_dialog_reveal_solution_text)
.setView(view)
.setMessage(resourceHandler.getStringInLocale(R.string.this_will_reveal_the_solution))
.setPositiveButton(resourceHandler.getStringInLocale(R.string.reveal)) { _, _ ->
.setMessage(
resourceHandler.getStringInLocale(
R.string.hint_solution_dialog_reveal_dialog_solution_text
)
)
.setPositiveButton(
resourceHandler.getStringInLocale(
R.string.hint_solution_dialog_reveal_dialog_button_text
)
) { _, _ ->
revealSolutionInterface.revealSolution()
dismiss()
}
.setNegativeButton(R.string.cellular_data_alert_dialog_cancel_button) { _, _ ->
.setNegativeButton(R.string.cellular_audio_dialog_cancel_button_text) { _, _ ->
dismiss()
}
.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class SolutionViewModel private constructor(
val correctAnswerContentDescription: String by lazy { computeCorrectAnswerContentDescription() }

private val correctAnswerTextStringResId = if (isSolutionExclusive) {
R.string.hints_list_exclusive_solution_text
} else R.string.hints_list_possible_solution_text
R.string.hint_solution_dialog_exclusive_solution_text
} else R.string.hint_solution_dialog_possible_solution_text

private fun computeCorrectAnswerHtml(): String {
val answerTextHtml = when (correctAnswer.objectTypeCase) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class PromotedStoryListViewModel(
resourceHandler.getStringInLocale(R.string.stories_for_you)
}
recentlyPlayedStoryList.isNotEmpty() -> {
resourceHandler.getStringInLocale(R.string.recently_played_stories)
resourceHandler.getStringInLocale(R.string.home_activity_recently_played_stories)
}
else -> {
resourceHandler.getStringInLocale(R.string.last_played_stories)
resourceHandler.getStringInLocale(R.string.home_activity_last_played_stories)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class PromotedStoryViewModel(
*/
fun computeLessonThumbnailContentDescription(): String {
return resourceHandler.getStringInLocaleWithWrapping(
R.string.lesson_thumbnail_content_description, nextChapterTitle
R.string.home_activity_lesson_thumbnail_description, nextChapterTitle
)
}
}
Loading
Loading