add QT internal translations

- currently german, spanish and russian is supported
 - drop W32 workaround for locale detection. QT does it correctly now.
 - add search-path for qt_*.qm
This commit is contained in:
Christian Hohnstaedt 2010-05-13 11:05:29 +02:00
parent 4df5c8a8dd
commit dffde3af3d
4 changed files with 29 additions and 22 deletions

View File

@ -78,9 +78,13 @@ Fix the missing System.dll in /usr/share/nsis/Plugins by
copying it from an NSIS windows installation.
Get the mingw runtime lib:
$ zcat /usr/share/doc/mingw32-runtime/mingwm10.dll.gz >mingwm10.dll
get the precompiled db_dump.exe from an other XCA installation
$ cp db_dump.exe xca-w32
translate the QT language files
$ lrelease-qt4 ../qt/4.6.2/translations/qt_*.ts
create the setup.exe
$ make setup.exe

View File

@ -44,7 +44,7 @@ pheaders: headers
clean:
for x in $(SUBDIRS) $(CLEANDIRS); do $(MAKE) -C $${x} clean; done
rm -f *~ xca$(SUFFIX) xca.o
rm -f *~ xca$(SUFFIX) xca.o setup_xca*.exe
distclean:
for x in $(SUBDIRS) $(CLEANDIRS); do $(MAKE) -C $${x} distclean; done
@ -74,7 +74,6 @@ setup.exe: xca$(SUFFIX) misc/xca.nsi doc lang
$(STRIP) xca$(SUFFIX)
$(MAKENSIS) -DINSTALLDIR=$(INSTALL_DIR) -DQTDIR=$(QTDIR) \
-DVERSION=$(VERSION) -DBDIR=$(BDIR) -NOCD -V2 misc/xca.nsi
cp setup.exe setup_xca-$(VERSION).exe
.PHONY: $(SUBDIRS) $(INSTDIR) xca.app setup.exe doc lang

View File

@ -20,30 +20,29 @@ int main( int argc, char *argv[] )
{
int ret = 0, pkictr;
QString locale;
QTranslator qtTr( 0 );
QTranslator xcaTr( 0 );
QTranslator qtTr;
QTranslator xcaTr;
MainWindow *mw;
QApplication a( argc, argv );
#ifdef WIN32
LANGID LangId = PRIMARYLANGID(GetUserDefaultLangID());
switch (LangId) {
case 0x07: locale="de"; break; //German
case 0x0a: locale="es"; break; //Spanish
case 0x0b: locale="fi"; break; //Finn
case 0x0c: locale="fr"; break; //French
case 0x0e: locale="hu"; break; //Hungarian
case 0x19: locale="ru"; break; //Russian
default: locale="c";
}
#else
locale = QLocale::system().name();
#endif
qtTr.load( QString( "qt_" ) + locale, "." );
xcaTr.load( QString( "xca_" ) + locale, getPrefix() );
a.installTranslator( &qtTr );
a.installTranslator( &xcaTr );
QStringList dirs;
dirs << getPrefix()
<< "/usr/local/share/qt4/translations/"
<< "/usr/share/qt4/translations/"
<< "/usr/share/qt/translations/"
<< ".";
foreach(QString dir, dirs) {
if (qtTr.load(QString("qt_%1").arg(locale), dir)) {
break;
}
}
xcaTr.load(QString("xca_%1").arg(locale), getPrefix());
a.installTranslator(&qtTr);
a.installTranslator(&xcaTr);
#ifdef Q_WS_MAC
QStringList libp = a.libraryPaths();

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "XCA"
Caption "XCA ${VERSION} Setup"
OutFile "setup.exe"
OutFile "setup_xca-${VERSION}.exe"
InstallDir $PROGRAMFILES\xca
; Registry key to check for directory (so if you install again, it will
@ -71,6 +71,11 @@ Section "xca (required)" SecMain
File "${QTDIR}\bin\QtGui4.dll"
File "${QTDIR}\bin\QtCore4.dll"
File "${QTDIR}\bin\libgcc_s_dw2-1.dll"
File "${QTDIR}\translations\qt_de.qm"
File "${QTDIR}\translations\qt_es.qm"
File "${QTDIR}\translations\qt_ru.qm"
File "${INSTALLDIR}\bin\libltdl-7.dll"
File "${INSTALLDIR}\bin\libeay32.dll"