Update strings to be more translation friendly
Use different strings for "None" based on the context of the string. Some languages may require different gendered grammar depending on its context. Also update contacts summary string to include plurals (1 vs many). Test: make RunSettingsRoboTests7 Bug: 154898476 Fixes: 154944295 Change-Id: If9949d75de573042389a19df3d4c5d15c6cbeb25
This commit is contained in:
@@ -287,13 +287,13 @@ public class ZenModeBackend {
|
||||
|
||||
protected int getAlarmsTotalSilencePeopleSummary(int category) {
|
||||
if (category == NotificationManager.Policy.PRIORITY_CATEGORY_MESSAGES) {
|
||||
return R.string.zen_mode_from_none;
|
||||
return R.string.zen_mode_none_messages;
|
||||
} else if (category == NotificationManager.Policy.PRIORITY_CATEGORY_CALLS){
|
||||
return R.string.zen_mode_from_none;
|
||||
return R.string.zen_mode_none_calls;
|
||||
} else if (category == NotificationManager.Policy.PRIORITY_CATEGORY_CONVERSATIONS) {
|
||||
return R.string.zen_mode_from_no_conversations;
|
||||
}
|
||||
return R.string.zen_mode_from_none;
|
||||
return R.string.zen_mode_from_no_conversations;
|
||||
}
|
||||
|
||||
protected int getConversationSummary() {
|
||||
@@ -322,7 +322,7 @@ public class ZenModeBackend {
|
||||
return R.string.zen_mode_from_starred;
|
||||
case ZenPolicy.PEOPLE_TYPE_NONE:
|
||||
default:
|
||||
return R.string.zen_mode_from_none;
|
||||
return R.string.zen_mode_none_calls;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public class ZenModeBackend {
|
||||
return R.string.zen_mode_from_starred;
|
||||
case ZenPolicy.PEOPLE_TYPE_NONE:
|
||||
default:
|
||||
return R.string.zen_mode_from_none;
|
||||
return R.string.zen_mode_none_messages;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ public class ZenModeBackend {
|
||||
List<String> displayContacts = new ArrayList<>();
|
||||
|
||||
if (numStarredContacts == 0) {
|
||||
displayContacts.add(context.getString(R.string.zen_mode_from_none));
|
||||
displayContacts.add(context.getString(R.string.zen_mode_starred_contacts_summary_none));
|
||||
} else {
|
||||
for (int i = 0; i < 2 && i < numStarredContacts; i++) {
|
||||
displayContacts.add(starredContacts.get(i));
|
||||
@@ -494,10 +494,11 @@ public class ZenModeBackend {
|
||||
String getContactsNumberSummary(Context context) {
|
||||
final int numContacts = queryAllContactsData().getCount();
|
||||
if (numContacts == 0) {
|
||||
return context.getResources().getString(R.string.zen_mode_from_none);
|
||||
return context.getResources().getString(
|
||||
R.string.zen_mode_contacts_count_none);
|
||||
}
|
||||
return context.getResources().getString(R.string.zen_mode_contacts_senders_summary,
|
||||
numContacts);
|
||||
return context.getResources().getQuantityString(R.plurals.zen_mode_contacts_count,
|
||||
numContacts, numContacts);
|
||||
}
|
||||
|
||||
private Cursor queryStarredContactsData() {
|
||||
|
@@ -91,7 +91,9 @@ public class ZenModePrioritySendersPreferenceController
|
||||
makeRadioPreference(KEY_ANY,
|
||||
com.android.settings.R.string.zen_mode_from_anyone);
|
||||
makeRadioPreference(KEY_NONE,
|
||||
com.android.settings.R.string.zen_mode_from_none);
|
||||
mIsMessages
|
||||
? com.android.settings.R.string.zen_mode_none_messages
|
||||
: com.android.settings.R.string.zen_mode_none_calls);
|
||||
updateSummaries();
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,10 @@ public class ZenModeSendersImagePreferenceController
|
||||
newImageRes = mIsMessages
|
||||
? R.drawable.zen_messages_none
|
||||
: R.drawable.zen_calls_none;
|
||||
newContentDescription = mContext.getString(R.string.zen_mode_from_none);
|
||||
newContentDescription =
|
||||
mContext.getString(mIsMessages
|
||||
? R.string.zen_mode_none_messages
|
||||
: R.string.zen_mode_none_calls);
|
||||
}
|
||||
|
||||
mImageView.setImageResource(newImageRes);
|
||||
|
@@ -156,7 +156,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|
||||
|| PRIORITY_CATEGORY_REPEAT_CALLERS == category, true);
|
||||
int numCategories = enabledCategories.size();
|
||||
if (numCategories == 0) {
|
||||
return mContext.getString(R.string.zen_mode_from_none);
|
||||
return mContext.getString(R.string.zen_mode_none_calls);
|
||||
} else if (numCategories == 1) {
|
||||
return mContext.getString(R.string.zen_mode_calls_summary_one,
|
||||
enabledCategories.get(0));
|
||||
@@ -172,7 +172,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|
||||
category -> PRIORITY_CATEGORY_MESSAGES == category, false);
|
||||
int numCategories = enabledCategories.size();
|
||||
if (numCategories == 0) {
|
||||
return mContext.getString(R.string.zen_mode_from_none);
|
||||
return mContext.getString(R.string.zen_mode_none_messages);
|
||||
} else {
|
||||
return enabledCategories.get(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user