initial implementation of the translation (must be enabled with --translation command line argument)

This commit is contained in:
Volker Fischer 2020-05-04 20:22:22 +02:00
parent f481e22937
commit 7421eefb11
7 changed files with 684 additions and 656 deletions

View file

@ -14,8 +14,8 @@ QT += widgets \
network \ network \
xml xml
#TRANSLATIONS = src/res/translation_de_DE.ts \ TRANSLATIONS = src/res/translation/translation_de_DE.ts \
# src/res/translation_fr_FR.ts src/res/translation/translation_fr_FR.ts
INCLUDEPATH += src INCLUDEPATH += src

View file

@ -45,14 +45,12 @@ int main ( int argc, char** argv )
// initialize all flags and string which might be changed by command line // initialize all flags and string which might be changed by command line
// arguments // arguments
#if defined( SERVER_BUNDLE ) && ( defined( __APPLE__ ) || defined( __MACOSX ) ) #if defined( SERVER_BUNDLE ) && ( defined( __APPLE__ ) || defined( __MACOSX ) )
// if we are on MacOS and we are building a server bundle, starts Jamulus in server mode // if we are on MacOS and we are building a server bundle, starts Jamulus in server mode
bool bIsClient = false; bool bIsClient = false;
#else #else
bool bIsClient = true; bool bIsClient = true;
#endif #endif
bool bUseGUI = true; bool bUseGUI = true;
bool bStartMinimized = false; bool bStartMinimized = false;
bool bShowComplRegConnList = false; bool bShowComplRegConnList = false;
@ -61,6 +59,7 @@ int main ( int argc, char** argv )
bool bShowAnalyzerConsole = false; bool bShowAnalyzerConsole = false;
bool bCentServPingServerInList = false; bool bCentServPingServerInList = false;
bool bNoAutoJackConnect = false; bool bNoAutoJackConnect = false;
bool bUseTranslation = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
int iMaxDaysHistory = DEFAULT_DAYS_HISTORY; int iMaxDaysHistory = DEFAULT_DAYS_HISTORY;
int iCtrlMIDIChannel = INVALID_MIDI_CH; int iCtrlMIDIChannel = INVALID_MIDI_CH;
@ -208,6 +207,21 @@ int main ( int argc, char** argv )
} }
// Enable translations -------------------------------------------------
// Undocumented debugging command line argument: Enable translations
// (since translation is still WIP, it is not enabled by default but
// must be enabled with this undocumented command line flag)
if ( GetFlagArgument ( argv,
i,
"--translation", // no short form
"--translation" ) )
{
bUseTranslation = true;
tsConsole << "- translations enabled" << endl;
continue;
}
// Show all registered servers in the server list ---------------------- // Show all registered servers in the server list ----------------------
// Undocumented debugging command line argument: Show all registered // Undocumented debugging command line argument: Show all registered
// servers in the server list regardless if a ping to the server is // servers in the server list regardless if a ping to the server is
@ -514,18 +528,16 @@ int main ( int argc, char** argv )
// init resources // init resources
Q_INIT_RESOURCE(resources); Q_INIT_RESOURCE(resources);
// load translations
QTranslator myappTranslator;
// TODO translation loading does not yet work if ( bUseGUI && bUseTranslation )
// TODO CONFIG += lrelease embed_translations {
// TODO QM_FILES_RESOURCE_PREFIX needed??? if ( myappTranslator.load ( ":/translations/translation.qm" ) )
// // load translations {
// if ( bUseGUI ) pApp->installTranslator ( &myappTranslator );
// { }
// QTranslator myappTranslator; }
// bool ret = myappTranslator.load ( "translation_" + QLocale::system().name() );
//qDebug() << "translation successfully loaded: " << ret << " " << "translation_" + QLocale::system().name();
// pApp->installTranslator ( &myappTranslator );
// }
// TEST -> activate the following line to activate the test bench, // TEST -> activate the following line to activate the test bench,

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +1,10 @@
<RCC> <RCC>
<qresource prefix="/translations" lang="de">
<file alias="translation.qm">res/translation/translation_de_DE.qm</file>
</qresource>
<qresource prefix="/translations" lang="fr">
<file alias="translation.qm">res/translation/translation_fr_FR.qm</file>
</qresource>
<qresource prefix="/png/LEDs"> <qresource prefix="/png/LEDs">
<file>res/CLEDDisabledSmall.png</file> <file>res/CLEDDisabledSmall.png</file>
<file>res/CLEDGreenArrow.png</file> <file>res/CLEDGreenArrow.png</file>