[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [PATCH] Add option to use traditional binary units instead of
From: Michael Pyne <mpyne () kde ! org>
Date: 2009-07-03 1:11:12
Message-ID: 200907022111.12421.mpyne () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
On Wednesday 01 July 2009 20:23:30 Michael Pyne wrote:
> This is forwarded from a discussion on kde-devel regarding binary units.
>
> I would like to commit the attached patch to trunk by the end of this week,
> if there are no major issues.
>
> Please please please do not email or flame about adding an option to use
> KB/MB instead of KiB/MiB without at least reading the kde-devel thread
> first.
Patch has been updated to account for recent changes to KLocale to make
formatByteSize() less painfully slow (attached).
Regards,
- Michael Pyne
["0001-klocale-use-si-binary-2.patch" (text/x-patch)]
Index: kdecore/localization/klocale.cpp
===================================================================
--- kdecore/localization/klocale.cpp (revision 990683)
+++ kdecore/localization/klocale.cpp (working copy)
@@ -232,6 +232,7 @@
int workingWeekEndDay;
int weekDayOfPray;
KLocale::DigitSet dateTimeDigitSet;
+ bool historicalBinaryUnits; // See IEC 60027-2 i.e. kibibyte, mebibyte, etc.
// FIXME: Temporary until full language-sensitivity implemented.
bool languageSensitiveDigits;
@@ -453,6 +454,8 @@
readConfigEntry("PositiveSign", "", positiveSign);
readConfigEntry("NegativeSign", "-", negativeSign);
+ readConfigEntry("HistoricalBinaryUnits", false, historicalBinaryUnits);
+
readConfigNumEntry("DigitSet", KLocale::ArabicDigits,
digitSet, KLocale::DigitSet);
// FIXME: Temporary until full language-sensitivity implemented.
@@ -1366,15 +1369,23 @@
translateRaw(x, 0, &s); \
d->byteSizeFmt.append(s); \
} while(0)
+
+ if (!d->historicalBinaryUnits) {
+ // i18n: Dumb messages, avoid any markup or scripting.
+ CACHEBYTEFMT(I18N_NOOP("%1 TiB"));
+ CACHEBYTEFMT(I18N_NOOP("%1 GiB"));
+ CACHEBYTEFMT(I18N_NOOP("%1 MiB"));
+ CACHEBYTEFMT(I18N_NOOP("%1 KiB"));
+ }
+ else {
+ // i18n: Dumb messages, avoid any markup or scripting.
+ CACHEBYTEFMT(I18N_NOOP("%1 TB"));
+ CACHEBYTEFMT(I18N_NOOP("%1 GB"));
+ CACHEBYTEFMT(I18N_NOOP("%1 MB"));
+ CACHEBYTEFMT(I18N_NOOP("%1 KB"));
+ }
+
// i18n: Dumb message, avoid any markup or scripting.
- CACHEBYTEFMT(I18N_NOOP("%1 TiB"));
- // i18n: Dumb message, avoid any markup or scripting.
- CACHEBYTEFMT(I18N_NOOP("%1 GiB"));
- // i18n: Dumb message, avoid any markup or scripting.
- CACHEBYTEFMT(I18N_NOOP("%1 MiB"));
- // i18n: Dumb message, avoid any markup or scripting.
- CACHEBYTEFMT(I18N_NOOP("%1 KiB"));
- // i18n: Dumb message, avoid any markup or scripting.
CACHEBYTEFMT(I18N_NOOP("%1 B"));
}
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic