Skip to content

Commit

Permalink
Add localization selection option.
Browse files Browse the repository at this point in the history
  • Loading branch information
scamille committed Jan 3, 2015
1 parent 6c6e8b8 commit 418d6d8
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 316 deletions.
Binary file modified locale/sc_de.qm
Binary file not shown.
322 changes: 165 additions & 157 deletions locale/sc_de.ts

Large diffs are not rendered by default.

Binary file modified locale/sc_zh.qm
Binary file not shown.
320 changes: 165 additions & 155 deletions locale/sc_zh.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions qt/SC_OptionsTab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class SC_OptionsTab : public QTabWidget
QComboBox* armory_region;
QComboBox* armory_spec;
QComboBox* default_role;
QComboBox* gui_localization;
QComboBox* boss_type;
QComboBox* tank_dummy;
QComboBox* tmi_boss;
Expand Down
21 changes: 18 additions & 3 deletions qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,25 @@ int main( int argc, char *argv[] )
QLibraryInfo::location( QLibraryInfo::TranslationsPath ) );
a.installTranslator( &qtTranslator );

QString path_to_locale = QString( "locale" );

QString lang("");
QSettings settings;
settings.beginGroup( "options" );
if ( settings.contains( "gui_localization" ) )
{
lang = settings.value( "gui_localization" ).toString();
qDebug() << "simc gui localization: " << lang;
}
settings.endGroup();
QTranslator myappTranslator;
myappTranslator.load( QString( "sc_" ) + QLocale::system().name(), path_to_locale );
if ( !lang.isEmpty() && lang != "en" )
{
QString path_to_locale("locale");

QString qm_file = QString( "sc_" ) + lang + ".qm";
//qDebug() << "qm file: " << qm_file;
myappTranslator.load( qm_file, path_to_locale );
//qDebug() << "translator: " << myappTranslator.isEmpty();
}
a.installTranslator( &myappTranslator );

// Setup search paths for resources
Expand Down
8 changes: 7 additions & 1 deletion qt/sc_options_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ SC_OptionsTab::SC_OptionsTab( SC_MainWindow* parent ) :
connect( choice.challenge_mode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.debug, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.default_role, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.gui_localization, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.boss_type, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.tank_dummy, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.tmi_boss, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
Expand Down Expand Up @@ -195,7 +196,7 @@ SC_OptionsTab::SC_OptionsTab( SC_MainWindow* parent ) :
connect( choice.thread_priority, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.version, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( choice.world_lag, SIGNAL( currentIndexChanged( int ) ), this, SLOT( _optionsChanged() ) );
connect( apikey, SIGNAL( currentIndexChanged( const QString& ) ), this, SLOT( _optionsChanged() ) );
connect( apikey, SIGNAL( textChanged( const QString& ) ), this, SLOT( _optionsChanged() ) );

connect( buffsButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( _optionsChanged() ) );
connect( debuffsButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( _optionsChanged() ) );
Expand Down Expand Up @@ -231,6 +232,7 @@ void SC_OptionsTab::createGlobalsTab()
globalsLayout_left -> addRow( tr( "Challenge Mode" ), choice.challenge_mode = createChoice( 2, "Disabled", "Enabled" ) );
globalsLayout_left -> addRow( tr( "Player Skill" ), choice.player_skill = createChoice( 4, "Elite", "Good", "Average", "Ouch! Fire is hot!" ) );
globalsLayout_left -> addRow( tr( "Default Role" ), choice.default_role = createChoice( 4, "Auto", "DPS", "Heal", "Tank" ) );
globalsLayout_left -> addRow( tr( "GUI Localization" ), choice.gui_localization = createChoice( 3, "en", "de", "zh" ) );

QPushButton* resetb = new QPushButton( tr("Reset all Settings" ), this );
QFont override_font = QFont();
Expand Down Expand Up @@ -676,6 +678,7 @@ void SC_OptionsTab::decodeOptions()
load_setting( settings, "thread_priority", choice.thread_priority, "Lowest" );
load_setting( settings, "armory_region", choice.armory_region );
load_setting( settings, "armory_spec", choice.armory_spec );
load_setting( settings, "gui_localization", choice.gui_localization );
load_setting( settings, "default_role", choice.default_role );
load_setting( settings, "boss_type", choice.boss_type, "Custom" );
load_setting( settings, "pvp_crit", choice.pvp_crit, "Disable" );
Expand Down Expand Up @@ -773,6 +776,7 @@ void SC_OptionsTab::encodeOptions()
settings.setValue( "threads", choice.threads -> currentText() );
settings.setValue( "thread_priority", choice.thread_priority -> currentText() );
settings.setValue( "armory_region", choice.armory_region -> currentText() );
settings.setValue( "gui_localization", choice.gui_localization -> currentText() );
settings.setValue( "armory_spec", choice.armory_spec -> currentText() );
settings.setValue( "default_role", choice.default_role -> currentText() );
settings.setValue( "boss_type", choice.boss_type -> currentText() );
Expand Down Expand Up @@ -880,6 +884,8 @@ void SC_OptionsTab::createToolTips()

choice.armory_spec -> setToolTip( tr( "Controls which Talent/Glyph specification is used when importing profiles from the Armory." ) );

choice.gui_localization -> setToolTip( tr( "Controls the GUI display language." ) );

choice.default_role -> setToolTip( tr( "Specify the character role during import to ensure correct action priority list." ) );

choice.boss_type -> setToolTip( tr( "Choose the type of target. Some choices can be refined further by the next two drop-down boxes" ) );
Expand Down

0 comments on commit 418d6d8

Please sign in to comment.