Commit e1f61968 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Make some strings easier to translate

Summary:
Some strings in ksysguard use this advanced feature of being actually
multiple strings separated by "\xc2\x9c" and then letting the UI use one
or another depending how much space is available.

This is a cool feature, but until this patch it was made in a way the
translatable strings actually contained "\xc2\x9c" that makes it
hard to translate correctly since it's not a trivial character to input.

With this patch I have splitted the character out of the translatable
strings

Test Plan: Works

Reviewers: #plasma, #localization, mart

Reviewed By: #plasma, mart

Subscribers: mart, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D12713
parent ec3471cf
......@@ -594,7 +594,7 @@ void FancyPlotter::sendDataToPlotter( )
if(sensor->maxValue != 0 && sensor->unit() != QLatin1String("%")) {
//Use a multi length string incase we do not have enough room
lastValue = i18n("%1 of %2" "\xc2\x9c" "%1", lastValue, mPlotter->valueAsString(sensor->maxValue, precision) );
lastValue = i18n("%1 of %2", lastValue, mPlotter->valueAsString(sensor->maxValue, precision) ) + "\xc2\x9c" + lastValue;
}
} else {
lastValue = i18n("Error");
......
......@@ -364,7 +364,8 @@ void TopLevel::timerEvent( QTimerEvent* )
}
void TopLevel::updateProcessCount() {
const QString s = i18np( "1 process" "\u009C" "1", "%1 processes" "\u009C" "%1", mLocalProcessController->processList()->visibleProcessesCount() );
const int count = mLocalProcessController->processList()->visibleProcessesCount();
const QString s = i18np( "1 process", "%1 processes", count ) + "\xc2\x9c" + QString::number( count );
sbProcessCount->setText( s );
}
void TopLevel::changeEvent( QEvent * event )
......@@ -443,9 +444,12 @@ void TopLevel::answerReceived( int id, const QList<QByteArray> &answerList )
switch ( id ) {
case 1:
s = i18n( "CPU: %1%\xc2\x9c%1%", (int) (100 - answer.toFloat()) );
{
const auto percent = (int) (100 - answer.toFloat());
s = i18n( "CPU: %1%", percent ) + "\xc2\x9c" + i18nc("This is the shorter version of CPU: %1%", "%1%", percent);
sbCpuStat->setText( s );
break;
}
case 2:
mFree = answer.toLongLong();
......@@ -456,13 +460,21 @@ void TopLevel::answerReceived( int id, const QList<QByteArray> &answerList )
break;
case 4:
{
const auto used = KFormat().formatByteSize( mUsedApplication*1024);
const auto total = KFormat().formatByteSize( (mFree+mUsedTotal)*1024 );
mUsedApplication = answer.toLongLong();
//Use a multi-length string
s = i18nc( "Arguments are formatted byte sizes (used/total)", "Memory: %1 / %2" "\xc2\x9c" "Mem: %1 / %2" "\xc2\x9c" "Mem: %1" "\xc2\x9c" "%1",
KFormat().formatByteSize( mUsedApplication*1024),
KFormat().formatByteSize( (mFree+mUsedTotal)*1024 ) );
s = i18nc( "Arguments are formatted byte sizes (used/total)", "Memory: %1 / %2", used, total );
s += "\xc2\x9c";
s += i18nc( "Arguments are formatted byte sizes (used/total) This should be a shorter version of the previous Memory: %1 / %2", "Mem: %1 / %2", used, total );
s += "\xc2\x9c";
s += i18nc( "Arguments is formatted byte sizes (used) This should be a shorter version of the previous Mem: %1 / %2", "Mem: %1", used );
s += "\xc2\x9c";
s += used;
sbMemTotal->setText( s );
break;
}
case 5:
sFree = answer.toLongLong();
......@@ -487,9 +499,13 @@ void TopLevel::setSwapInfo( qlonglong used, qlonglong free, const QString & )
if ( used == 0 && free == 0 ) // no swap available
msg = i18n( " No swap space available " );
else {
msg = i18nc( "Arguments are formatted byte sizes (used/total)", "Swap: %1 / %2" "\xc2\x9c" "Swap: %1" "\xc2\x9c" "%1" ,
KFormat().formatByteSize( used*1024 ),
KFormat().formatByteSize( (free+used)*1024) );
const auto formattedUsed = KFormat().formatByteSize( used*1024 );
const auto formattedTotal = KFormat().formatByteSize( (free+used)*1024);
msg = i18nc( "Arguments are formatted byte sizes (used/total)", "Swap: %1 / %2", formattedUsed, formattedTotal );
msg += "\xc2\x9c";
msg += i18nc( "Arguments is formatted byte sizes (used)", "Swap: %1", formattedUsed );
msg += "\xc2\x9c";
msg += formattedUsed;
}
sbSwapTotal->setText( msg );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment