mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-05-07 19:16:37 +02:00
Update for translations
This commit is contained in:
@@ -33,8 +33,8 @@ TEMPLATE = app
|
||||
# Translations
|
||||
#
|
||||
TRANSLATIONS = \
|
||||
languages/$${TARGET}_en.ts \
|
||||
languages/$${TARGET}_nl.ts
|
||||
languages/$${TARGET}.en_US.ts \
|
||||
languages/$${TARGET}.nl.ts
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
@@ -218,7 +218,7 @@ HEADERS += \
|
||||
FORMS += \
|
||||
debugwidget.ui \
|
||||
preferences.ui \
|
||||
aboutdialog.ui
|
||||
aboutdialog.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
|
||||
@@ -12,5 +12,7 @@
|
||||
<file>files/icons/mail-unread.png</file>
|
||||
<file>files/icons/help-about.png</file>
|
||||
<file>files/icons/dialog-warning.png</file>
|
||||
<file>languages/SysTray-X.en_US.qm</file>
|
||||
<file>languages/SysTray-X.nl.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -36,6 +36,18 @@ DebugWidget::DebugWidget( Preferences* pref, QWidget* parent ) : QWidget( parent
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the language change event
|
||||
*/
|
||||
void DebugWidget::changeEvent( QEvent* event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
m_ui->retranslateUi( this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the number of unread mail
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,13 @@ class DebugWidget : public QWidget
|
||||
*/
|
||||
explicit DebugWidget( Preferences* pref, QWidget* parent = nullptr );
|
||||
|
||||
/**
|
||||
* @brief changeEvent. Override the change event.
|
||||
*
|
||||
* @param event The event.
|
||||
*/
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
/**
|
||||
* @brief setUnreadMail. Set the number of unread mails.
|
||||
*
|
||||
|
||||
Binary file not shown.
@@ -227,14 +227,24 @@
|
||||
<translation>Display debug window</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferencesdialog.cpp" line="356"/>
|
||||
<location filename="../preferencesdialog.cpp" line="380"/>
|
||||
<location filename="../preferences.ui" line="490"/>
|
||||
<source>Save</source>
|
||||
<translation>Save</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferences.ui" line="497"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferencesdialog.cpp" line="368"/>
|
||||
<location filename="../preferencesdialog.cpp" line="392"/>
|
||||
<source>Open Image</source>
|
||||
<translation>Open Image</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferencesdialog.cpp" line="356"/>
|
||||
<location filename="../preferencesdialog.cpp" line="380"/>
|
||||
<location filename="../preferencesdialog.cpp" line="368"/>
|
||||
<location filename="../preferencesdialog.cpp" line="392"/>
|
||||
<source>Image Files (*.png *.jpg *.bmp)</source>
|
||||
<translation>Image Files (*.png *.jpg *.bmp)</translation>
|
||||
</message>
|
||||
@@ -242,24 +252,29 @@
|
||||
<context>
|
||||
<name>SysTrayX</name>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="182"/>
|
||||
<location filename="../systrayx.cpp" line="190"/>
|
||||
<source>&Show/Hide</source>
|
||||
<translation>&Show/Hide</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="186"/>
|
||||
<location filename="../systrayx.cpp" line="194"/>
|
||||
<source>&Preferences</source>
|
||||
<translation>&Preferences</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="190"/>
|
||||
<location filename="../systrayx.cpp" line="198"/>
|
||||
<source>&About</source>
|
||||
<translation>&About</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="194"/>
|
||||
<location filename="../systrayx.cpp" line="202"/>
|
||||
<source>&Quit</source>
|
||||
<translation>&Quit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="571"/>
|
||||
<source>Close</source>
|
||||
<translation>Close</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
Binary file not shown.
@@ -227,14 +227,24 @@
|
||||
<translation>Toon debug venster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferencesdialog.cpp" line="356"/>
|
||||
<location filename="../preferencesdialog.cpp" line="380"/>
|
||||
<location filename="../preferences.ui" line="490"/>
|
||||
<source>Save</source>
|
||||
<translation>Bewaren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferences.ui" line="497"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Annnuleren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferencesdialog.cpp" line="368"/>
|
||||
<location filename="../preferencesdialog.cpp" line="392"/>
|
||||
<source>Open Image</source>
|
||||
<translation>Open afbeelding</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../preferencesdialog.cpp" line="356"/>
|
||||
<location filename="../preferencesdialog.cpp" line="380"/>
|
||||
<location filename="../preferencesdialog.cpp" line="368"/>
|
||||
<location filename="../preferencesdialog.cpp" line="392"/>
|
||||
<source>Image Files (*.png *.jpg *.bmp)</source>
|
||||
<translation>Afbeeldingsbestanden (*.png *.jpg *.bmp)</translation>
|
||||
</message>
|
||||
@@ -242,24 +252,29 @@
|
||||
<context>
|
||||
<name>SysTrayX</name>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="182"/>
|
||||
<location filename="../systrayx.cpp" line="190"/>
|
||||
<source>&Show/Hide</source>
|
||||
<translation>&Tonen/Verbergen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="186"/>
|
||||
<location filename="../systrayx.cpp" line="194"/>
|
||||
<source>&Preferences</source>
|
||||
<translation>&Opties</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="190"/>
|
||||
<location filename="../systrayx.cpp" line="198"/>
|
||||
<source>&About</source>
|
||||
<translation>O&ver</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="194"/>
|
||||
<location filename="../systrayx.cpp" line="202"/>
|
||||
<source>&Quit</source>
|
||||
<translation>&Afsluiten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../systrayx.cpp" line="571"/>
|
||||
<source>Close</source>
|
||||
<translation>Sluiten</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
@@ -111,8 +111,8 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
|
||||
*/
|
||||
connect( m_ui->chooseCustomDefaultIconButton, &QPushButton::clicked, this, &PreferencesDialog::slotDefaultFileSelect );
|
||||
connect( m_ui->chooseCustomButton, &QPushButton::clicked, this, &PreferencesDialog::slotFileSelect );
|
||||
connect( m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreferencesDialog::slotAccept );
|
||||
connect( m_ui->buttonBox, &QDialogButtonBox::rejected, this, &PreferencesDialog::slotReject );
|
||||
connect( m_ui->savePushButton, &QPushButton::clicked, this, &PreferencesDialog::slotAccept );
|
||||
connect( m_ui->cancelPushButton, &QPushButton::clicked, this, &PreferencesDialog::slotReject );
|
||||
connect( m_ui->numberColorPushButton, &QPushButton::clicked, this, &PreferencesDialog::slotColorSelect );
|
||||
|
||||
/*
|
||||
@@ -127,6 +127,18 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the language change event
|
||||
*/
|
||||
void PreferencesDialog::changeEvent( QEvent* event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
m_ui->retranslateUi( this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the debug state
|
||||
*/
|
||||
@@ -358,6 +370,31 @@ void PreferencesDialog::slotReject()
|
||||
* Close it
|
||||
*/
|
||||
// QDialog::reject();
|
||||
|
||||
/*
|
||||
* Restore values
|
||||
*/
|
||||
setDefaultIconType( m_pref->getDefaultIconType() );
|
||||
setDefaultIcon( m_pref->getDefaultIconMime(), m_pref->getDefaultIconData() );
|
||||
setHideDefaultIcon( m_pref->getHideDefaultIcon() );
|
||||
|
||||
setIconType( m_pref->getIconType() );
|
||||
setIcon( m_pref->getIconMime(), m_pref->getIconData() );
|
||||
|
||||
setMinimizeType( m_pref->getMinimizeType() );
|
||||
setStartMinimized( m_pref->getStartMinimized() );
|
||||
setMinimizeOnClose( m_pref->getMinimizeOnClose() );
|
||||
|
||||
setShowNumber( m_pref->getShowNumber() );
|
||||
setNumberColor( m_pref->getNumberColor() );
|
||||
setNumberSize( m_pref->getNumberSize() );
|
||||
setCountType( m_pref->getCountType() );
|
||||
|
||||
setDebug( m_pref->getDebug() );
|
||||
|
||||
/*
|
||||
* Hide it
|
||||
*/
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,13 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWidget *parent = nullptr );
|
||||
|
||||
/**
|
||||
* @brief changeEvent. Override the change event.
|
||||
*
|
||||
* @param event The event.
|
||||
*/
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <QIcon>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
@@ -38,6 +39,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
m_tray_icon_menu = nullptr;
|
||||
|
||||
m_unread_mail = 0;
|
||||
m_locale = QString();
|
||||
|
||||
/*
|
||||
* Setup preferences storage
|
||||
@@ -149,6 +151,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
connect( m_link, &SysTrayXLink::signalTitle, m_win_ctrl, &WindowCtrl::slotWindowTitle );
|
||||
connect( m_link, &SysTrayXLink::signalVersion, this, &SysTrayX::slotVersion );
|
||||
connect( m_link, &SysTrayXLink::signalKdeIntegration, this, &SysTrayX::slotSelectIconObject );
|
||||
connect( m_link, &SysTrayXLink::signalLocale, this, &SysTrayX::slotLoadLanguage );
|
||||
|
||||
/*
|
||||
* SysTrayX
|
||||
@@ -159,6 +162,12 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
* Request preferences from add-on
|
||||
*/
|
||||
getPreferences();
|
||||
|
||||
/*
|
||||
slotLoadLanguage( "nl" );
|
||||
//slotLoadLanguage( "en_US" );
|
||||
slotSelectIconObject( false );
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -587,6 +596,11 @@ void SysTrayX::slotAbout()
|
||||
ui.hash->setText( m_preferences->getHash() );
|
||||
ui.branch->setText( m_preferences->getBranch() );
|
||||
|
||||
/*
|
||||
* Set the translation for the button box
|
||||
*/
|
||||
ui.buttonBox->button( QDialogButtonBox::Close )->setText( tr( "Close" ) );
|
||||
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
@@ -624,3 +638,27 @@ void SysTrayX::slotSetUnreadMail( int unread )
|
||||
{
|
||||
m_unread_mail = unread;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle a change in locale
|
||||
*/
|
||||
void SysTrayX::slotLoadLanguage( QString locale )
|
||||
{
|
||||
if( m_locale != locale)
|
||||
{
|
||||
m_locale = locale;
|
||||
|
||||
if (!m_translator.isEmpty())
|
||||
{
|
||||
qApp->removeTranslator( &m_translator );
|
||||
}
|
||||
|
||||
QString locale_path = "SysTray-X."+ locale;
|
||||
bool status = m_translator.load( locale_path, ":/languages/" );
|
||||
qApp->installTranslator( &m_translator );
|
||||
|
||||
|
||||
emit signalConsole( QString( "Language loaded %1").arg(status));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* Qt includes
|
||||
*/
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
/*
|
||||
@@ -130,6 +131,13 @@ class SysTrayX : public QObject
|
||||
*/
|
||||
void slotSetUnreadMail( int unread );
|
||||
|
||||
/**
|
||||
* @brief slotLoadLanguage. Handle locale change signal.
|
||||
*
|
||||
* @param locale The requested locale.
|
||||
*/
|
||||
void slotLoadLanguage( QString locale );
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
@@ -219,6 +227,16 @@ class SysTrayX : public QObject
|
||||
* @brief m_unread_mail. Number of unread mails
|
||||
*/
|
||||
int m_unread_mail;
|
||||
|
||||
/**
|
||||
* @brief m_translator. The translator object.
|
||||
*/
|
||||
QTranslator m_translator;
|
||||
|
||||
/**
|
||||
* @brief m_locale. Storage for the current locale.
|
||||
*/
|
||||
QString m_locale;
|
||||
};
|
||||
|
||||
#endif // SYSTRAYX_H
|
||||
|
||||
@@ -374,6 +374,13 @@ void SysTrayXLink::DecodeMessage( const QByteArray& message )
|
||||
#endif
|
||||
}
|
||||
|
||||
if( jsonObject.contains( "locale" ) && jsonObject[ "locale" ].isString() )
|
||||
{
|
||||
QString locale = jsonObject[ "locale" ].toString();
|
||||
|
||||
emit signalLocale( locale );
|
||||
}
|
||||
|
||||
if( jsonObject.contains( "platformInfo" ) && jsonObject[ "platformInfo" ].isObject() )
|
||||
{
|
||||
DecodePlatform( jsonObject[ "platformInfo" ].toObject() );
|
||||
|
||||
@@ -198,6 +198,11 @@ class SysTrayXLink : public QObject
|
||||
*/
|
||||
void signalKdeIntegration( bool state );
|
||||
|
||||
/**
|
||||
* @brief signalLocale. Signal the locale.
|
||||
*/
|
||||
void signalLocale( QString locale );
|
||||
|
||||
/**
|
||||
* @brief signalUnreadMail. Signal numder of unread mails.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,9 @@ SysTrayX.Messaging = {
|
||||
// Lookout for storage changes
|
||||
browser.storage.onChanged.addListener(SysTrayX.Messaging.storageChanged);
|
||||
|
||||
// Send the platform info to app
|
||||
SysTrayX.Messaging.sendLocale();
|
||||
|
||||
// Send the platform info to app
|
||||
SysTrayX.Messaging.sendPlatformInfo();
|
||||
|
||||
@@ -154,6 +157,16 @@ SysTrayX.Messaging = {
|
||||
});
|
||||
},
|
||||
|
||||
sendLocale: function () {
|
||||
const locale = browser.i18n.getUILanguage();
|
||||
|
||||
console.log("Locale: " + locale);
|
||||
|
||||
SysTrayX.Link.postSysTrayXMessage({
|
||||
locale: locale,
|
||||
});
|
||||
},
|
||||
|
||||
sendPreferences: function () {
|
||||
const getter = browser.storage.sync.get([
|
||||
"debug",
|
||||
|
||||
Reference in New Issue
Block a user