summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index aec74fa..7f31ab1 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -1,203 +1,203 @@
#include <qregexp.h>
#include <qapplication.h>
#include "kdebug.h"
#include "kcalendarsystemgregorian.h"
#include "klocale.h"
#include <qstringlist.h>
-#define COLLECT_TRANSLATION
+//#define COLLECT_TRANSLATION
QDict<QString> *mLocaleDict = 0;
void setLocaleDict( QDict<QString> * dict )
{
mLocaleDict = dict;
}
#ifdef COLLECT_TRANSLATION
QStringList missingTrans;
QStringList existingTrans1;
QStringList existingTrans2;
void addMissing(const char *text)
{
QString mis ( text );
if ( !missingTrans.contains( mis ) )
missingTrans.append(mis);
}
void addExist(const char *text,QString trans )
{
//return;
QString mis ( text );
if ( !existingTrans1.contains( mis ) ) {
existingTrans1.append(mis);
existingTrans2.append(trans);
}
}
#include <qfile.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#endif
void dumpMissing()
{
#ifdef COLLECT_TRANSLATION
QString fileName = "/tmp/usernewtrans.txt";
QFile file( fileName );
if (!file.open( IO_WriteOnly ) ) {
return ;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
int i;
for ( i = 0; i< missingTrans.count(); ++i ) {
QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" );
ts << "{ \""<<text<< "\",\""<< text <<"\" },\n";
}
file.close();
{
QString fileName = "/tmp/usertrans.txt";
QFile file( fileName );
if (!file.open( IO_WriteOnly ) ) {
return ;
}
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
int i;
for ( i = 0; i< existingTrans1.count(); ++i ) {
QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" );
QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" );
ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n";
}
file.close();
}
#endif
}
QString i18n(const char *text)
{
if ( ! mLocaleDict ) {
#ifdef COLLECT_TRANSLATION
addMissing( text );
#endif
return QString( text );
}
else {
QString* ret = mLocaleDict->find(QString(text)) ;
if ( ret == 0 ) {
#ifdef COLLECT_TRANSLATION
addMissing( text );
#endif
return QString( text );
}
else {
if ( (*ret).isEmpty() ) {
#ifdef COLLECT_TRANSLATION
addMissing( text );
#endif
return QString( text );
}
else {
#ifdef COLLECT_TRANSLATION
addExist( text, *ret );
#endif
return (*ret);
}
}
}
}
QString i18n(const char *,const char *text)
{
return i18n( text );
}
QString i18n(const char *text1, const char *textn, int num)
{
if ( num == 1 ) return i18n( text1 );
else {
QString text = i18n( textn );
int pos = text.find( "%n" );
if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) );
return text;
}
}
inline void put_it_in( QChar *buffer, uint& index, const QString &s )
{
for ( uint l = 0; l < s.length(); l++ )
buffer[index++] = s.at( l );
}
inline void put_it_in( QChar *buffer, uint& index, int number )
{
buffer[index++] = number / 10 + '0';
buffer[index++] = number % 10 + '0';
}
static int readInt(const QString &str, uint &pos)
{
if (!str.at(pos).isDigit()) return -1;
int result = 0;
for (; str.length() > pos && str.at(pos).isDigit(); pos++)
{
result *= 10;
result += str.at(pos).digitValue();
}
return result;
}
KLocale::KLocale() : mCalendarSystem( 0 )
{
m_decimalSymbol = ".";
m_positiveSign = "";
m_negativeSign = "-";
m_thousandsSeparator = ",";
mWeekStartsMonday = true;
mHourF24Format = true;
mIntDateFormat = Default;
mIntTimeFormat = Default;
mLanguage = 0;
mDateFormat = "%a %Y %b %d";
mDateFormatShort = "%Y-%m-%d";
mTimeZoneList << ("-11:00 US/Samoa")
<< ("-10:00 US/Hawaii")
<< ("-09:00 US/Alaska")
<< ("-08:00 US/Pacific")
<< ("-07:00 US/Mountain")
<< ("-06:00 US/Central")
<< ("-05:00 US/Eastern")
<< ("-04:00 Brazil/West")
<< ("-03:00 Brazil/East")
<< ("-02:00 Brazil/DeNoronha")
<< ("-01:00 Atlantic/Azores")
<< (" 00:00 Europe/London(UTC)")
<< ("+01:00 Europe/Oslo(CET)")
<< ("+02:00 Europe/Helsinki")
<< ("+03:00 Europe/Moscow")
<< ("+04:00 Indian/Mauritius")
<< ("+05:00 Indian/Maldives")
<< ("+06:00 Indian/Chagos")
<< ("+07:00 Asia/Bangkok")
<< ("+08:00 Asia/Hongkong")