From a4b40c99a162eaef9912a55742ec2f9ae210526d Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sat, 22 Aug 2020 15:04:41 -0500 Subject: [PATCH] i18n --- .gitignore | 1 - akashi.pro | 5 ++++- resource/translation/akashi_en_US.ts | 3 --- resource/translation/akashi_es.qm | Bin 0 -> 158 bytes resource/translation/akashi_es.ts | 25 +++++++++++++++++++++++++ resources.qrc | 5 +++++ src/main.cpp | 10 ++++++++-- 7 files changed, 42 insertions(+), 7 deletions(-) delete mode 100644 resource/translation/akashi_en_US.ts create mode 100644 resource/translation/akashi_es.qm create mode 100644 resource/translation/akashi_es.ts create mode 100644 resources.qrc diff --git a/.gitignore b/.gitignore index fab7372..6e844ee 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ *.so.* *_pch.h.cpp *_resource.rc -*.qm .#* *.*# core diff --git a/akashi.pro b/akashi.pro index 62dbdcb..a75c453 100644 --- a/akashi.pro +++ b/akashi.pro @@ -22,9 +22,12 @@ HEADERS += $$files($$PWD/include/*.h) FORMS += $$files($$PWD/resource/forms/*.ui) TRANSLATIONS += \ - resource/translation/akashi_en_US.ts + resource/translation/akashi_es.ts # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target + +RESOURCES += \ + resources.qrc diff --git a/resource/translation/akashi_en_US.ts b/resource/translation/akashi_en_US.ts deleted file mode 100644 index 79e1ff8..0000000 --- a/resource/translation/akashi_en_US.ts +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/resource/translation/akashi_es.qm b/resource/translation/akashi_es.qm new file mode 100644 index 0000000000000000000000000000000000000000..5015f0ea26e8f7ef932c330f6eb423920ddd38d9 GIT binary patch literal 158 zcmcE7ks@*G{hX<16=n7(EZlq7iGhKEgE4OEP9V*Y3B;w$K*E8+l_8g*fFYHkiXoAq zh(Q6!$^nwaK)Q&b45%=LAs;MW3}oj4Wk6&JST+r)qlyD$92*eJ1eN9~lw_nT6sH!I jr4}iaXO?8-mzF3bD!7MwvI7;c + + + + AkashiMain + + + AkashiMain + + + + + main + + + A server for Attorney Online 2 + + + + + Run the server without a GUI + Empezar el servidor sin interfaz + + + diff --git a/resources.qrc b/resources.qrc new file mode 100644 index 0000000..4117cd0 --- /dev/null +++ b/resources.qrc @@ -0,0 +1,5 @@ + + + resource/translation/akashi_es.qm + + diff --git a/src/main.cpp b/src/main.cpp index a078275..7a0e3ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { @@ -11,12 +12,17 @@ int main(int argc, char *argv[]) QApplication::setApplicationName("akashi"); QApplication::setApplicationVersion("0.0.1"); + QTranslator translator; + QString language = QLocale().bcp47Name(); + translator.load("akashi_" + language, ":/resource/translation/"); + app.installTranslator(&translator); + QCommandLineParser parser; - parser.setApplicationDescription("A server for Attorney Online 2"); + parser.setApplicationDescription(app.translate("main", "A server for Attorney Online 2")); parser.addHelpOption(); parser.addVersionOption(); - QCommandLineOption headlessOption(QStringList() << "l" << "headless", "Run the server without a GUI"); + QCommandLineOption headlessOption(QStringList() << "l" << "headless", app.translate("main", "Run the server without a GUI")); parser.addOption(headlessOption); parser.process(app);