summaryrefslogtreecommitdiffstats
path: root/tdecore/tests/klocaletest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdecore/tests/klocaletest.cpp')
-rw-r--r--tdecore/tests/klocaletest.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/tdecore/tests/klocaletest.cpp b/tdecore/tests/klocaletest.cpp
index 3c8df342e..bcb7bc9e8 100644
--- a/tdecore/tests/klocaletest.cpp
+++ b/tdecore/tests/klocaletest.cpp
@@ -70,19 +70,19 @@ void Test::createFields()
TQString string;
string+="Selected languages: ";
- string+=KGlobal::locale()->languages()+"\n";
+ string+=TDEGlobal::locale()->languages()+"\n";
// This will show nothing, as there is no klocaletest.mo
// but you can copy other *.mo file
string+="Used language: ";
- string+=KGlobal::locale()->language()+"\n";
+ string+=TDEGlobal::locale()->language()+"\n";
string+="Locale encoding: ";
- string+=TQString::fromLatin1(KGlobal::locale()->encoding())+"\n";
+ string+=TQString::fromLatin1(TDEGlobal::locale()->encoding())+"\n";
string+="Localized date and time: ";
- string+=KGlobal::locale()->formatDateTime(TQDateTime::currentDateTime());
+ string+=TDEGlobal::locale()->formatDateTime(TQDateTime::currentDateTime());
string+="\nLocalized monetary numbers: ";
- string+=KGlobal::locale()->formatMoney(1234567.89) + " / \n" +KGlobal::locale()->formatMoney(-1234567.89);
+ string+=TDEGlobal::locale()->formatMoney(1234567.89) + " / \n" +TDEGlobal::locale()->formatMoney(-1234567.89);
// This will not work
// but you can copy other *.mo file
string+="\nSome localized strings:\n";
@@ -93,7 +93,7 @@ void Test::createFields()
label=new TQLabel(string,this,"Label");
label->setGeometry(10,10,400,400);
- label->setFont(KGlobalSettings::generalFont());
+ label->setFont(TDEGlobalSettings::generalFont());
label->show();
}
@@ -102,47 +102,47 @@ int main( int argc, char ** argv )
KLocale::setMainCatalogue("tdelibs");
TDEApplication a( argc, argv, "klocaletest" );
- KGlobal::locale()->setLanguage(TQString::fromLatin1("en_US"));
- KGlobal::locale()->setCountry(TQString::fromLatin1("C"));
- KGlobal::locale()->setThousandsSeparator(TQString::fromLatin1(","));
+ TDEGlobal::locale()->setLanguage(TQString::fromLatin1("en_US"));
+ TDEGlobal::locale()->setCountry(TQString::fromLatin1("C"));
+ TDEGlobal::locale()->setThousandsSeparator(TQString::fromLatin1(","));
TQString formatted;
- formatted = KGlobal::locale()->formatNumber( 70 ); check("formatNumber(70)",formatted,"70.00");
- formatted = KGlobal::locale()->formatNumber( 70, 0 ); check("formatNumber(70, 0)",formatted,"70");
- formatted = KGlobal::locale()->formatNumber( 70.2 ); check("formatNumber(70.2)",formatted,"70.20");
- formatted = KGlobal::locale()->formatNumber( 70.24 ); check("formatNumber(70.24)",formatted,"70.24");
- formatted = KGlobal::locale()->formatNumber( 70.245 ); check("formatNumber(70.245)",formatted,"70.25"); /*rounded*/
- formatted = KGlobal::locale()->formatNumber(1234567.89123456789,8); check("formatNumber(1234567.89123456789,8)",formatted,"1,234,567.89123457");
+ formatted = TDEGlobal::locale()->formatNumber( 70 ); check("formatNumber(70)",formatted,"70.00");
+ formatted = TDEGlobal::locale()->formatNumber( 70, 0 ); check("formatNumber(70, 0)",formatted,"70");
+ formatted = TDEGlobal::locale()->formatNumber( 70.2 ); check("formatNumber(70.2)",formatted,"70.20");
+ formatted = TDEGlobal::locale()->formatNumber( 70.24 ); check("formatNumber(70.24)",formatted,"70.24");
+ formatted = TDEGlobal::locale()->formatNumber( 70.245 ); check("formatNumber(70.245)",formatted,"70.25"); /*rounded*/
+ formatted = TDEGlobal::locale()->formatNumber(1234567.89123456789,8); check("formatNumber(1234567.89123456789,8)",formatted,"1,234,567.89123457");
- formatted = KGlobal::locale()->formatNumber("70"); check("formatNumber(\"70\")",formatted,"70.00");
- formatted = KGlobal::locale()->formatNumber("70", true, 2); check("formatNumber(\"70\", true, 2)",formatted,"70.00");
- formatted = KGlobal::locale()->formatNumber("70", true, 0); check("formatNumber(\"70\", true, 0)",formatted,"70");
- formatted = KGlobal::locale()->formatNumber("70.9123", true, 0); check("formatNumber(\"70.9123\", true, 0)",formatted,"71"); /* rounded */
- formatted = KGlobal::locale()->formatNumber("-70.2", true, 2); check("formatNumber(\"-70.2\", true, 2)",formatted,"-70.20");
- formatted = KGlobal::locale()->formatNumber("+70.24", true, 2); check("formatNumber(\"+70.24\", true, 2)",formatted,"70.24");
- formatted = KGlobal::locale()->formatNumber("70.245", true, 2); check("formatNumber(\"70.245\", true, 2)",formatted,"70.25"); /*rounded*/
- formatted = KGlobal::locale()->formatNumber("99.996", true, 2); check("formatNumber(\"99.996\", true, 2)",formatted,"100.00"); /*rounded*/
- formatted = KGlobal::locale()->formatNumber("12345678901234567.89123456789", false, 0); check("formatNumber(\"12345678901234567.89123456789\", false, 0)",formatted,"12,345,678,901,234,567.89123456789");
+ formatted = TDEGlobal::locale()->formatNumber("70"); check("formatNumber(\"70\")",formatted,"70.00");
+ formatted = TDEGlobal::locale()->formatNumber("70", true, 2); check("formatNumber(\"70\", true, 2)",formatted,"70.00");
+ formatted = TDEGlobal::locale()->formatNumber("70", true, 0); check("formatNumber(\"70\", true, 0)",formatted,"70");
+ formatted = TDEGlobal::locale()->formatNumber("70.9123", true, 0); check("formatNumber(\"70.9123\", true, 0)",formatted,"71"); /* rounded */
+ formatted = TDEGlobal::locale()->formatNumber("-70.2", true, 2); check("formatNumber(\"-70.2\", true, 2)",formatted,"-70.20");
+ formatted = TDEGlobal::locale()->formatNumber("+70.24", true, 2); check("formatNumber(\"+70.24\", true, 2)",formatted,"70.24");
+ formatted = TDEGlobal::locale()->formatNumber("70.245", true, 2); check("formatNumber(\"70.245\", true, 2)",formatted,"70.25"); /*rounded*/
+ formatted = TDEGlobal::locale()->formatNumber("99.996", true, 2); check("formatNumber(\"99.996\", true, 2)",formatted,"100.00"); /*rounded*/
+ formatted = TDEGlobal::locale()->formatNumber("12345678901234567.89123456789", false, 0); check("formatNumber(\"12345678901234567.89123456789\", false, 0)",formatted,"12,345,678,901,234,567.89123456789");
double num;
bool ok;
- num = KGlobal::locale()->readNumber( "12,1", &ok ); check("readNumber(12,1)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,100", &ok ); check("readNumber(12,100)",ok?"yes":"no","yes");
- num = KGlobal::locale()->readNumber( "12,100000,000", &ok ); check("readNumber(12,100000,000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,100000000", &ok ); check("readNumber(12,100000000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,100000,000", &ok ); check("readNumber(12,100000,000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,,100,000", &ok ); check("readNumber(12,,100,000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,1000,000", &ok ); check("readNumber(12,1000,000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,0000000,000", &ok ); check("readNumber(12,0000000,000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,0000000", &ok ); check("readNumber(12,0000000)",ok?"yes":"no","no");
- num = KGlobal::locale()->readNumber( "12,146,131.12", &ok ); check("readNumber(12,146,131.12)",ok?"yes":"no","yes");
- num = KGlobal::locale()->readNumber( "1.12345678912", &ok );
+ num = TDEGlobal::locale()->readNumber( "12,1", &ok ); check("readNumber(12,1)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,100", &ok ); check("readNumber(12,100)",ok?"yes":"no","yes");
+ num = TDEGlobal::locale()->readNumber( "12,100000,000", &ok ); check("readNumber(12,100000,000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,100000000", &ok ); check("readNumber(12,100000000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,100000,000", &ok ); check("readNumber(12,100000,000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,,100,000", &ok ); check("readNumber(12,,100,000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,1000,000", &ok ); check("readNumber(12,1000,000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,0000000,000", &ok ); check("readNumber(12,0000000,000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,0000000", &ok ); check("readNumber(12,0000000)",ok?"yes":"no","no");
+ num = TDEGlobal::locale()->readNumber( "12,146,131.12", &ok ); check("readNumber(12,146,131.12)",ok?"yes":"no","yes");
+ num = TDEGlobal::locale()->readNumber( "1.12345678912", &ok );
tqDebug( "%s", TQString::number( num, 'g', 12 ).latin1() ); // warning this is the only way to see all decimals
check("readNumber(1.12345678912)",ok && num==1.12345678912?"yes":"no","yes");
// bug 95511
- KLocale locale(*KGlobal::locale());
+ KLocale locale(*TDEGlobal::locale());
locale.setCurrencySymbol("$$");
num = locale.readMoney("1,234,567.89$$", &ok);
check("readMoney(1,234,567.89$$)",ok?"yes":"no","yes");
@@ -151,41 +151,41 @@ int main( int argc, char ** argv )
TQDate date;
date.setYMD( 2002, 5, 3 );
- checkDate("readDate( 3, 5, 2002 )",date,KGlobal::locale()->readDate( KGlobal::locale()->formatDate( date ) ) );
+ checkDate("readDate( 3, 5, 2002 )",date,TDEGlobal::locale()->readDate( TDEGlobal::locale()->formatDate( date ) ) );
date = TQDate::currentDate();
- checkDate("readDate( TQDate::currentDate() )",date,KGlobal::locale()->readDate( KGlobal::locale()->formatDate( date ) ) );
+ checkDate("readDate( TQDate::currentDate() )",date,TDEGlobal::locale()->readDate( TDEGlobal::locale()->formatDate( date ) ) );
TQTime time;
- time = KGlobal::locale()->readTime( "11:22:33", &ok );
+ time = TDEGlobal::locale()->readTime( "11:22:33", &ok );
check("readTime(\"11:22:33\")", (ok && time == TQTime(11, 22, 33)) ?
"yes" : "no", "yes");
- time = KGlobal::locale()->readTime( "11:22", &ok );
+ time = TDEGlobal::locale()->readTime( "11:22", &ok );
check("readTime(\"11:22\")", (ok && time == TQTime(11, 22, 0)) ?
"yes" : "no", "yes");
- time = KGlobal::locale()->readTime( "foo", &ok );
+ time = TDEGlobal::locale()->readTime( "foo", &ok );
check("readTime(\"foo\")", (!ok && !time.isValid()) ?
"invalid" : "valid", "invalid");
- time = KGlobal::locale()->readTime( "11:22:33", KLocale::WithoutSeconds, &ok );
+ time = TDEGlobal::locale()->readTime( "11:22:33", KLocale::WithoutSeconds, &ok );
check("readTime(\"11:22:33\", WithoutSeconds)", (!ok && !time.isValid()) ?
"invalid" : "valid", "invalid");
- time = KGlobal::locale()->readTime( "11:22", KLocale::WithoutSeconds, &ok );
+ time = TDEGlobal::locale()->readTime( "11:22", KLocale::WithoutSeconds, &ok );
check("readTime(\"11:22\", WithoutSeconds)", (ok && time == TQTime(11, 22, 0)) ?
"yes" : "no", "yes");
- KGlobal::locale()->setTimeFormat( "%H:%M %p" );
+ TDEGlobal::locale()->setTimeFormat( "%H:%M %p" );
time = TQTime( 0, 22, 33 );
- TQString timeStr = KGlobal::locale()->formatTime( time, true /*seconds*/, false /*duration*/ );
+ TQString timeStr = TDEGlobal::locale()->formatTime( time, true /*seconds*/, false /*duration*/ );
check("formatTime(\"0:22\", as time)", timeStr, "00:22 am" );
- timeStr = KGlobal::locale()->formatTime( time, true /*seconds*/, true /*duration*/ );
+ timeStr = TDEGlobal::locale()->formatTime( time, true /*seconds*/, true /*duration*/ );
check("formatTime(\"0:22\", as duration)", timeStr, "00:22" );
kdDebug() << "setLanguage C\n";
- KGlobal::locale()->setLanguage(TQString::fromLatin1("C"));
+ TDEGlobal::locale()->setLanguage(TQString::fromLatin1("C"));
kdDebug() << "C: " << i18n("yes") << " " << i18n(TQACCEL_OBJECT_NAME_STRING, "Space") << endl;
kdDebug() << "setLanguage de\n";
- KGlobal::locale()->setLanguage(TQString::fromLatin1("de"));
+ TDEGlobal::locale()->setLanguage(TQString::fromLatin1("de"));
kdDebug() << "de: " << i18n("yes") << " " << i18n(TQACCEL_OBJECT_NAME_STRING, "Space") << endl;