# HG changeset patch # User Wuzzy # Date 1544729090 -3600 # Node ID fbe5e49462aaca53cc8de5b403762cb98c581993 # Parent 9b53b46ede3e720d6521b9fb9abc5da1e189390b Make about dialog in frontend translatable diff -r 9b53b46ede3e -r fbe5e49462aa .hgignore --- a/.hgignore Thu Dec 13 18:55:25 2018 +0100 +++ b/.hgignore Thu Dec 13 20:24:50 2018 +0100 @@ -20,6 +20,7 @@ cmake_install.cmake QTfrontend/hwconsts.cpp QTfrontend/servermessages.h +QTfrontend/creditsmessages.h CPackConfig.cmake CPackSourceConfig.cmake tools/cmake_uninstall.cmake diff -r 9b53b46ede3e -r fbe5e49462aa QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Thu Dec 13 18:55:25 2018 +0100 +++ b/QTfrontend/CMakeLists.txt Thu Dec 13 20:24:50 2018 +0100 @@ -45,6 +45,29 @@ list(APPEND locsout ${firstline} "\n}\\;\n") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/servermessages.h ${locsout}) + +# Credits localization +file(GLOB CreditsCSV ${CMAKE_SOURCE_DIR}/QTfrontend/res/credits.csv) +foreach(csvfile ${CreditsCSV}) + file(READ ${csvfile} csv) + string(REGEX MATCHALL "\n(\"[^\n\"]+\")" locs ${csv}) + foreach(str ${locs}) + string(REGEX REPLACE "\"([^\n\"]+)\"" "QT_TRANSLATE_NOOP(\"credits\", \"\\1\")" s ${str}) + list(APPEND csvlocs ${s}) + endforeach(str) +endforeach(csvfile) + +list(REMOVE_DUPLICATES csvlocs) +list(GET csvlocs 0 firstline) +list(REMOVE_AT csvlocs 0) +set(locsout "const char * creditsMessages[] = {") +foreach(l ${csvlocs}) + list(APPEND locsout ${l} ",") +endforeach(l) +list(APPEND locsout ${firstline} "\n}\\;\n") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/creditsmessages.h ${locsout}) + + include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model) diff -r 9b53b46ede3e -r fbe5e49462aa QTfrontend/res/credits.csv --- a/QTfrontend/res/credits.csv Thu Dec 13 18:55:25 2018 +0100 +++ b/QTfrontend/res/credits.csv Thu Dec 13 20:24:50 2018 +0100 @@ -89,7 +89,7 @@ "Rock","HSR ", "olympics_sd","yd ", "oriental","Jonatan Nilsson", -"sdmusic (""Hitman [sheepluva edit]"")","Kevin MacLeod", +"sdmusic (Hitman [sheepluva edit])","Kevin MacLeod", "snow","Jonatan Nilsson", !__MISC,, !__SECTION,"Translations", @@ -138,4 +138,4 @@ ,"Aleksey Andreev","blaknayabr@gmail.com", ,"Aleksander Rudalev","alexv@pomorsu.ru", ,"Natasha Korotaeva","layout@pisem.net", -,"Adam ""ahigerd"" Higerd", +,"Adam Higerd (alias ahigerd)", diff -r 9b53b46ede3e -r fbe5e49462aa QTfrontend/ui/widget/about.cpp --- a/QTfrontend/ui/widget/about.cpp Thu Dec 13 18:55:25 2018 +0100 +++ b/QTfrontend/ui/widget/about.cpp Thu Dec 13 20:24:50 2018 +0100 @@ -32,6 +32,8 @@ #include "SDL.h" #include "SDL_version.h" #include "physfs.h" +#include "creditsmessages.h" +#include "HWApplication.h" #ifdef VIDEOREC extern "C" @@ -160,19 +162,33 @@ QString mailLink = QString("%1").arg(mail); if(task.isEmpty() && mail.isEmpty()) { + // Name only out = out + "
  • " + name + "
  • \n"; } else if(task.isEmpty()) { + // Name and e-mail + //: Part of credits. %1: Contribution name. %2: E-mail address out = out + "
  • " + tr("%1 <%2>").arg(name).arg(mailLink) + "
  • \n"; } else if(mail.isEmpty()) { - out = out + "
  • " + tr("%1: %2").arg(task).arg(name) + "
  • \n"; + // Contribution and name + //: Part of credits. %1: Description of contribution. %2: Contributor name + out = out + "
  • " + tr("%1: %2") + .arg(HWApplication::translate("credits", task.toLatin1().constData())) + .arg(name) + + "
  • \n"; } else { - out = out + "
  • " + tr("%1: %2 <%3>").arg(task).arg(name).arg(mailLink) + "
  • \n"; + // Contribution, name and e-mail + //: Part of credits. %1: Description of contribution. %2: Contributor name. %3: E-mail address + out = out + "
  • " + tr("%1: %2 <%3>") + .arg(HWApplication::translate("credits", task.toLatin1().constData())) + .arg(name) + .arg(mailLink) + + "
  • \n"; } } lineComplete = false;