Fix localization for devices in other languages.
Bug: 275073444
Test: Manually
Change-Id: Ifdece12eaa046479ce509b3e7a7502b6c8ffbc71
Merged-In: I39640260cb636f1a14a1ad374add7e983f70ea00
diff --git a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/DeviceUtils.java b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/DeviceUtils.java
index 925a344..8c37529 100644
--- a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/DeviceUtils.java
+++ b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/DeviceUtils.java
@@ -63,27 +63,27 @@
}
/**
- * Returns a string representation of a device form factor. Supported form factors are:
- * {@link #{R.string.mr_device_form_factor_phone} and
- * @link #{R.string.mr_device_form_factor_tablet} and
- * @link #{R.string.mr_device_form_factor_tv} and
- * @link #{R.string.mr_device_form_factor_watch} and
- * @link #{R.string.mr_device_form_factor_car} and
- * @link #{R.string.mr_device_form_factor_unknown}}
+ * Returns a device specific string representation of wifi warning description. It can be one
+ * of the following values: {@link #{R.string.mr_chooser_wifi_warning_description_phone} and
+ * @link #{R.string.mr_chooser_wifi_warning_description_tablet} and
+ * @link #{R.string.mr_chooser_wifi_warning_description_tv} and
+ * @link #{R.string.mr_chooser_wifi_warning_description_watch} and
+ * @link #{R.string.mr_chooser_wifi_warning_description_car} and
+ * @link #{R.string.mr_chooser_wifi_warning_description_unknown}}
*/
- static String getDeviceFormFactorString(@NonNull Context context) {
+ static String getDialogChooserWifiWarningDescription(@NonNull Context context) {
if (isPhone(context) || isFoldable(context)) {
- return context.getString(R.string.mr_device_form_factor_phone);
+ return context.getString(R.string.mr_chooser_wifi_warning_description_phone);
} else if (isTablet(context) || isSevenInchTablet(context)) {
- return context.getString(R.string.mr_device_form_factor_tablet);
+ return context.getString(R.string.mr_chooser_wifi_warning_description_tablet);
} else if (isTv(context)) {
- return context.getString(R.string.mr_device_form_factor_tv);
+ return context.getString(R.string.mr_chooser_wifi_warning_description_tv);
} else if (isWearable(context)) {
- return context.getString(R.string.mr_device_form_factor_watch);
+ return context.getString(R.string.mr_chooser_wifi_warning_description_watch);
} else if (isAuto(context)) {
- return context.getString(R.string.mr_device_form_factor_car);
+ return context.getString(R.string.mr_chooser_wifi_warning_description_car);
} else {
- return context.getString(R.string.mr_device_form_factor_unknown);
+ return context.getString(R.string.mr_chooser_wifi_warning_description_unknown);
}
}
diff --git a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteChooserDialog.java b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteChooserDialog.java
index 13c2dc7..b18543e 100644
--- a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteChooserDialog.java
+++ b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/MediaRouteChooserDialog.java
@@ -237,10 +237,7 @@
mOkButton = findViewById(R.id.mr_chooser_ok_button);
mSearchingProgressBar = findViewById(R.id.mr_chooser_search_progress_bar);
-
- String formFactor = DeviceUtils.getDeviceFormFactorString(getContext());
- String wifiWarningText =
- getContext().getString(R.string.mr_chooser_wifi_warning_description, formFactor);
+ String wifiWarningText = DeviceUtils.getDialogChooserWifiWarningDescription(getContext());
mWifiWarningTextView.setText(wifiWarningText);
mLearnMoreTextView.setMovementMethod(LinkMovementMethod.getInstance());
diff --git a/mediarouter/mediarouter/src/main/res/layout/mr_chooser_dialog.xml b/mediarouter/mediarouter/src/main/res/layout/mr_chooser_dialog.xml
index 5050bf4..5735fe5 100644
--- a/mediarouter/mediarouter/src/main/res/layout/mr_chooser_dialog.xml
+++ b/mediarouter/mediarouter/src/main/res/layout/mr_chooser_dialog.xml
@@ -70,7 +70,7 @@
android:id="@+id/mr_chooser_wifi_warning_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/mr_chooser_wifi_warning_description"
+ android:text="@string/mr_chooser_wifi_warning_description_phone"
android:textAppearance="@style/TextAppearance.MediaRouter.SecondaryText" />
<TextView
diff --git a/mediarouter/mediarouter/src/main/res/values/strings.xml b/mediarouter/mediarouter/src/main/res/values/strings.xml
index fa295bd..7cb83b0a6 100644
--- a/mediarouter/mediarouter/src/main/res/values/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values/strings.xml
@@ -102,17 +102,14 @@
<string name="mr_chooser_zero_routes_found_title">No devices available</string>
<!-- Text displayed to hint making sure device and cast device are connected to the same Wi-Fi. [CHAR_LIMIT=NONE] -->
- <string name="mr_chooser_wifi_warning_description">Make sure the other device is on the same Wi-Fi network as this %s</string>
+ <string name="mr_chooser_wifi_warning_description_phone">Make sure the other device is on the same Wi-Fi network as this phone</string>
+ <string name="mr_chooser_wifi_warning_description_tablet">Make sure the other device is on the same Wi-Fi network as this tablet</string>
+ <string name="mr_chooser_wifi_warning_description_tv">Make sure the other device is on the same Wi-Fi network as this tv</string>
+ <string name="mr_chooser_wifi_warning_description_watch">Make sure the other device is on the same Wi-Fi network as this watch</string>
+ <string name="mr_chooser_wifi_warning_description_car">Make sure the other device is on the same Wi-Fi network as this car</string>
+ <string name="mr_chooser_wifi_warning_description_unknown">Make sure the other device is on the same Wi-Fi network as this device</string>
<!-- Text displayed to link the user to the support article. [CHAR_LIMIT=NONE] -->
<string name="mr_chooser_wifi_learn_more"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">Learn more</a></string>
<string name="ic_media_route_learn_more_accessibility">Learn how to cast</string>
-
- <!-- Text displayed representing different form factors of devices. [CHAR_LIMIT=NONE] -->
- <string name="mr_device_form_factor_phone">phone</string>
- <string name="mr_device_form_factor_tablet">tablet</string>
- <string name="mr_device_form_factor_tv">tv</string>
- <string name="mr_device_form_factor_watch">watch</string>
- <string name="mr_device_form_factor_car">car</string>
- <string name="mr_device_form_factor_unknown">device</string>
</resources>