L10n fix for IW locale in storage_summary string

storage_summary is passed as a single string of format "32 GB".
Spliting the phrase to allow TC to remove whitespace in case of iw
translations.

Old Translation : <free_space>
New Translation: <free_space_value> <free_space_unit>

Bug: 387197875
Test: manual
Flag: EXEMPT bugfix
Change-Id: I91abf58df472650a6278b08e4daa5d32e7f90da9
This commit is contained in:
Garvita Jain
2025-02-18 11:34:24 +00:00
parent 5703095c5c
commit 4e5595050f
4 changed files with 10 additions and 7 deletions

View File

@@ -92,9 +92,10 @@ public class TopLevelStoragePreferenceController extends BasePreferenceControlle
private String getSummary(long usedBytes, long totalBytes) {
NumberFormat percentageFormat = NumberFormat.getPercentInstance();
final String[] freeSpace =
Formatter.formatFileSize(mContext, totalBytes - usedBytes).split(" ");
return mContext.getString(R.string.storage_summary,
totalBytes == 0L ? "0" : percentageFormat.format(((double) usedBytes) / totalBytes),
Formatter.formatFileSize(mContext, totalBytes - usedBytes));
freeSpace[0], freeSpace[1]);
}
}

View File

@@ -64,7 +64,9 @@ public class LowStorageSlice implements CustomSliceable {
// Generate Low storage Slice.
final String percentageString = NumberFormat.getPercentInstance().format(usedPercentage);
final String freeSizeString = Formatter.formatFileSize(mContext, info.freeBytes);
final String[] freeSizeString =
Formatter.formatFileSize(mContext, info.freeBytes).split(" ");
final ListBuilder listBuilder = new ListBuilder(mContext,
CustomSliceRegistry.LOW_STORAGE_SLICE_URI, ListBuilder.INFINITY).setAccentColor(
Utils.getColorAccentDefaultColor(mContext));
@@ -74,7 +76,7 @@ public class LowStorageSlice implements CustomSliceable {
// For clients that ignore error checking, a generic storage slice will be given.
final CharSequence titleStorage = mContext.getText(R.string.storage_settings);
final String summaryStorage = mContext.getString(R.string.storage_summary,
percentageString, freeSizeString);
percentageString, freeSizeString[0], freeSizeString[1]);
return listBuilder
.addRow(buildRowBuilder(titleStorage, summaryStorage, icon))