l10n: Extract strings

This commit is contained in:
Neeraj Gupta 2023-05-05 14:45:07 +05:30
parent c31c8554e0
commit 64708bc704
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
5 changed files with 52 additions and 14 deletions

View file

@ -157,6 +157,9 @@ class MessageLookup extends MessageLookupByLibrary {
static String m32(storageAmountInGB) => "${storageAmountInGB} GB";
static String m59(usedAmount, userUnit, totalAmount, totalAmountUnit) =>
"${usedAmount} ${userUnit} of ${totalAmount} ${totalAmountUnit} used";
static String m33(id) =>
"Your ${id} is already linked to another ente account.\nIf you would like to use your ${id} with this account, please contact our support\'\'";
@ -1059,6 +1062,7 @@ class MessageLookup extends MessageLookupByLibrary {
"storageInGB": m32,
"storageLimitExceeded":
MessageLookupByLibrary.simpleMessage("Storage limit exceeded"),
"storageUsageInfo": m59,
"strongStrength": MessageLookupByLibrary.simpleMessage("Strong"),
"subAlreadyLinkedErrMessage": m33,
"subWillBeCancelledOn": m34,

View file

@ -6873,6 +6873,17 @@ class S {
args: [],
);
}
/// `{usedAmount} {userUnit} of {totalAmount} {totalAmountUnit} used`
String storageUsageInfo(Object usedAmount, Object userUnit,
Object totalAmount, Object totalAmountUnit) {
return Intl.message(
'$usedAmount $userUnit of $totalAmount $totalAmountUnit used',
name: 'storageUsageInfo',
desc: 'Example: 1.2 GB of 2 GB used or 100 GB or 2TB used',
args: [usedAmount, userUnit, totalAmount, totalAmountUnit],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View file

@ -957,5 +957,10 @@
"storageBreakupYou": "You",
"@storageBreakupYou": {
"description": "Label to indicate how much storage you are using when you are part of a family plan"
},
"storageUsageInfo" : "{usedAmount} {userUnit} of {totalAmount} {totalAmountUnit} used",
"@storageUsageInfo" :{
"description": "Example: 1.2 GB of 2 GB used or 100 GB or 2TB used"
}
}

View file

@ -317,24 +317,42 @@ class _StorageCardWidgetState extends State<StorageCardWidget> {
}) {
if (isMobileScreenSmall) {
return [
TextSpan(text: usedStorageInGB.toString() + "/"),
TextSpan(text: totalStorageInGB.toString() + " GB"),
TextSpan(text: '$usedStorageInGB/$totalStorageInGB GB'),
];
}
late num currentUsage, totalStorage;
late String currentUsageUnit, totalStorageUnit;
// Determine the appropriate usage and units
if (shouldShowUsedStorageInTBs) {
currentUsage = usedStorageInTB;
currentUsageUnit = "TB";
} else if (shouldShowUsedStorageInMBs) {
currentUsage = convertBytesToMBs(usedStorageInBytes);
currentUsageUnit = "MB";
} else {
currentUsage = usedStorageInGB;
currentUsageUnit = "GB";
}
// Determine the appropriate total storage and units
if (shouldShowTotalStorageInTBs) {
totalStorage = totalStorageInTB;
totalStorageUnit = "TB";
} else {
totalStorage = totalStorageInGB;
totalStorageUnit = "GB";
}
return [
TextSpan(
text: shouldShowUsedStorageInTBs
? usedStorageInTB.toString() + " TB of "
: shouldShowUsedStorageInMBs
? convertBytesToMBs(usedStorageInBytes).toString() + " MB of "
: usedStorageInGB.toString() + " GB of ",
),
TextSpan(
text: shouldShowTotalStorageInTBs
? totalStorageInTB.toString() + " TB used"
: totalStorageInGB.toString() + " GB used",
),
text: S.of(context).storageUsageInfo(
currentUsage,
currentUsageUnit,
totalStorage,
totalStorageUnit,
),
)
];
}
}

View file

@ -44,7 +44,7 @@ int convertBytesToMBs(int bytes) {
}
//Eg: 1TB, 1.3TB, 4.9TB, 3TB
roundGBsToTBs(sizeInGBs) {
num roundGBsToTBs(sizeInGBs) {
final num sizeInTBs = num.parse((sizeInGBs / 1000).toStringAsFixed(1));
if (sizeInTBs % 1 == 0) {
return sizeInTBs.truncate();