* FixStringForSize : without context, the locale kit was in trouble finding the right string.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37753 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-07-26 09:22:02 +00:00
parent 924b42436f
commit f700bfd569
1 changed files with 10 additions and 6 deletions

View File

@ -30,30 +30,34 @@ string_for_size(double size, char* string, size_t stringSize)
double kib = size / 1024.0;
if (kib < 1.0) {
const char* trKey = B_TRANSLATE_MARK("%d bytes");
snprintf(string, stringSize, gLocaleBackend->GetString(trKey),
(int)size);
snprintf(string, stringSize, gLocaleBackend->GetString(trKey,
B_TRANSLATE_CONTEXT), (int)size);
return string;
}
double mib = kib / 1024.0;
if (mib < 1.0) {
const char* trKey = B_TRANSLATE_MARK("%3.2f KiB");
snprintf(string, stringSize, gLocaleBackend->GetString(trKey), kib);
snprintf(string, stringSize, gLocaleBackend->GetString(trKey,
B_TRANSLATE_CONTEXT), kib);
return string;
}
double gib = mib / 1024.0;
if (gib < 1.0) {
const char* trKey = B_TRANSLATE_MARK("%3.2f MiB");
snprintf(string, stringSize, gLocaleBackend->GetString(trKey), mib);
snprintf(string, stringSize, gLocaleBackend->GetString(trKey,
B_TRANSLATE_CONTEXT), mib);
return string;
}
double tib = gib / 1024.0;
if (tib < 1.0) {
const char* trKey = B_TRANSLATE_MARK("%3.2f GiB");
snprintf(string, stringSize, gLocaleBackend->GetString(trKey), gib);
snprintf(string, stringSize, gLocaleBackend->GetString(trKey,
B_TRANSLATE_CONTEXT), gib);
return string;
}
const char* trKey = B_TRANSLATE_MARK("%.2f TiB");
snprintf(string, stringSize, gLocaleBackend->GetString(trKey), tib);
snprintf(string, stringSize, gLocaleBackend->GetString(trKey,
B_TRANSLATE_CONTEXT), tib);
return string;
}