give the possibility to translate the prefix und unit strings
Details
Diff Detail
- Repository
- R244 KCoreAddons
- Branch
- translate_units
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 3582 Build 3600: arc lint + arc unit
@bruns please have a look at the changes. In particular, regarding "µ" and windows support. I don't know if this will be able to compile on windows, or how to fix it for tr() function.
@safaalfulaij please verify if this fixes the RTL issue for you
Since the joining between number and format is translatable, that's great. I meant that if it is kept untranslatable, problems regarding RTL will happen.
src/lib/util/kformatprivate.cpp | ||
---|---|---|
116–132 | Line 160: } else { value /= entry->binaryFactor; prefixString = QString(entry->prefixChar).toUpper(); How this is “Metric”? | |
168–170 | And what about this? It should never be a puzzle string by the way. |
Sorry, I don't understand clearly, will this patch (once all issues are fixed) solve your problem or not?
src/lib/util/kformatprivate.cpp | ||
---|---|---|
116–132 | The prefixes for the IEC binary prefixes (for e.g. 2^10) are made up by the SI prefixes plus an "i", see below. But it actually is an SI prefix, to be more precise. | |
168–170 | Overlooked that one. Must this then be something like tr("1%2%).arg(... ...)? |
I came into anther problem, this time with the unit selection.
In Arabic, we don't put a dot between the prefix and the unit if we're talking about meters (mm, cm, km), but we do with other units (k.Byte, M.Byte, G.Byte).
If ki18n was used here, all of this can be locale-specific, but unfortunately that's not the case. I think I understand now why there are many strings for all of this unit stuff.
src/lib/util/kformatprivate.cpp | ||
---|---|---|
168–170 | Well, I searched other languages and no one seems to do as Arabic does. We do not abbreviate in this case and just write the whole "Mebi.Byte" ("Byte" is always written, "M.Byte" > "MB"). |
src/lib/util/kformatprivate.cpp | ||
---|---|---|
168–170 | I uploaded a new version, but with what you describe, this will not suffice to fulfill your needs for IEC binary prefixes (please confirm). For the record, I haven't seen it anywhere in English that dots are put in between. I'm away for the next week, so will continue to work on the patch afterwards. |
Thanks!
I think this solved all my issues. I can for meter unit change the formatting so that tr("%1 %2", "no Prefix") is translated to "%1%2" and choose to keep the dot or remove it in the unitStrings translation. ("bit" -> ".bit", "m" -> "m")
By the way, shouldn't that also be the case for English? I don't see people write "1 m" but "1m", "200 B" but "200B", same for Hz, not sure about bits. The space is not there when abbreviation is used.
Great! Now looking forward to feedback from @bruns regarding the implementation :)
Scientifically it is correct to put a (small) space between value and unit.
If no-one objects or has any comments regarding coding, I'm going to land this revision in one week