Merge branch 'feature_localization' of github.com:MultiMC/MultiMC5 into develop
This commit is contained in:
commit
2ae60038aa
@ -4,6 +4,7 @@ project(MultiMC)
|
||||
######## Set CMake options ########
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
SET(FILES_TO_TRANSLATE )
|
||||
|
||||
# Output all executables and shared libs in the main build folder, not in subfolders.
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
@ -32,6 +33,7 @@ ENDIF()
|
||||
# Find the required Qt parts
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
||||
@ -308,6 +310,8 @@ gui/OneSixModEditDialog.ui
|
||||
gui/EditNotesDialog.ui
|
||||
)
|
||||
|
||||
set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${MULTIMC_SOURCES} ${MULTIMC_UIS} ${MULTIMC_HEADERS})
|
||||
|
||||
|
||||
######## Windows resource files ########
|
||||
IF(WIN32)
|
||||
@ -479,3 +483,18 @@ ENDIF()
|
||||
INCLUDE(CPack)
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
### translation stuff
|
||||
|
||||
file (GLOB TRANSLATIONS_FILES translations/*.ts)
|
||||
|
||||
option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files (WARNING: make clean will delete the source .ts files! Danger!)")
|
||||
if (UPDATE_TRANSLATIONS)
|
||||
qt5_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
|
||||
else (UPDATE_TRANSLATIONS)
|
||||
qt5_add_translation(QM_FILES ${TRANSLATIONS_FILES})
|
||||
endif (UPDATE_TRANSLATIONS)
|
||||
|
||||
add_custom_target (translations_target DEPENDS ${QM_FILES})
|
||||
|
||||
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/translations)
|
60
MultiMC.cpp
60
MultiMC.cpp
@ -3,6 +3,8 @@
|
||||
#include <iostream>
|
||||
#include <QDir>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
#include "gui/mainwindow.h"
|
||||
#include "logic/lists/InstanceList.h"
|
||||
@ -25,6 +27,8 @@ MultiMC::MultiMC ( int& argc, char** argv )
|
||||
setOrganizationName("Forkk");
|
||||
setApplicationName("MultiMC 5");
|
||||
|
||||
initTranslations();
|
||||
|
||||
// Print app header
|
||||
std::cout << "MultiMC 5" << std::endl;
|
||||
std::cout << "(c) 2013 MultiMC Contributors" << std::endl << std::endl;
|
||||
@ -142,10 +146,64 @@ MultiMC::MultiMC ( int& argc, char** argv )
|
||||
|
||||
MultiMC::~MultiMC()
|
||||
{
|
||||
if(m_mmc_translator)
|
||||
{
|
||||
removeTranslator(m_mmc_translator);
|
||||
delete m_mmc_translator;
|
||||
m_mmc_translator = nullptr;
|
||||
}
|
||||
if(m_qt_translator)
|
||||
{
|
||||
removeTranslator(m_qt_translator);
|
||||
delete m_qt_translator;
|
||||
m_qt_translator = nullptr;
|
||||
}
|
||||
delete m_settings;
|
||||
delete m_metacache;
|
||||
}
|
||||
|
||||
void MultiMC::initTranslations()
|
||||
{
|
||||
m_qt_translator = new QTranslator();
|
||||
if(m_qt_translator->load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
||||
{
|
||||
std::cout
|
||||
<< "Loading Qt Language File for "
|
||||
<< QLocale::system().name().toLocal8Bit().constData()
|
||||
<< "...";
|
||||
if(!installTranslator(m_qt_translator))
|
||||
{
|
||||
std::cout << " failed.";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_qt_translator;
|
||||
m_qt_translator = nullptr;
|
||||
}
|
||||
|
||||
m_mmc_translator = new QTranslator();
|
||||
if(m_mmc_translator->load("mmc_" + QLocale::system().name(), QDir("translations").absolutePath()))
|
||||
{
|
||||
std::cout
|
||||
<< "Loading MMC Language File for "
|
||||
<< QLocale::system().name().toLocal8Bit().constData()
|
||||
<< "...";
|
||||
if(!installTranslator(m_mmc_translator))
|
||||
{
|
||||
std::cout << " failed.";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_mmc_translator;
|
||||
m_mmc_translator = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MultiMC::initGlobalSettings()
|
||||
{
|
||||
m_settings = new INISettingsObject("multimc.cfg", this);
|
||||
@ -228,6 +286,8 @@ int main(int argc, char *argv[])
|
||||
MainWindow mainWin;
|
||||
mainWin.show();
|
||||
|
||||
|
||||
|
||||
switch(app.status())
|
||||
{
|
||||
case MultiMC::Initialized:
|
||||
|
@ -65,7 +65,11 @@ private:
|
||||
void initGlobalSettings();
|
||||
|
||||
void initHttpMetaCache();
|
||||
|
||||
void initTranslations();
|
||||
private:
|
||||
QTranslator * m_qt_translator = nullptr;
|
||||
QTranslator * m_mmc_translator = nullptr;
|
||||
SettingsObject * m_settings = nullptr;
|
||||
InstanceList * m_instances = nullptr;
|
||||
IconList * m_icons = nullptr;
|
||||
|
@ -91,7 +91,7 @@ void ConsoleWindow::on_btnKillMinecraft_clicked()
|
||||
QMessageBox r_u_sure;
|
||||
//: Main question of the kill confirmation dialog
|
||||
r_u_sure.setText(tr("Kill Minecraft?"));
|
||||
r_u_sure.setInformativeText("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason");
|
||||
r_u_sure.setInformativeText(tr("This can cause the instance to get corrupted and should only be used if Minecraft is frozen for some reason"));
|
||||
r_u_sure.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
r_u_sure.setDefaultButton(QMessageBox::Yes);
|
||||
if (r_u_sure.exec() == QMessageBox::Yes)
|
||||
|
1271
translations/mmc_de.ts
Normal file
1271
translations/mmc_de.ts
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user