Added support for more languages

Chinese, Czech, Spanish, Hungarian, Italian, Japanese and Turkish
This commit is contained in:
Sude 2013-03-23 16:07:42 +02:00
parent 97e948abb4
commit c40b4d96fe
4 changed files with 57 additions and 2 deletions

View File

@ -29,6 +29,13 @@ extern "C" {
#define LANGUAGE_FR 4 #define LANGUAGE_FR 4
#define LANGUAGE_PL 8 #define LANGUAGE_PL 8
#define LANGUAGE_RU 16 #define LANGUAGE_RU 16
#define LANGUAGE_CN 32
#define LANGUAGE_CZ 64
#define LANGUAGE_ES 128
#define LANGUAGE_HU 256
#define LANGUAGE_IT 512
#define LANGUAGE_JP 1024
#define LANGUAGE_TR 2048
class gameFile { class gameFile {
public: public:

View File

@ -61,9 +61,15 @@ int main(int argc, char *argv[])
+ std::to_string(LANGUAGE_FR) + " = French\n" + std::to_string(LANGUAGE_FR) + " = French\n"
+ std::to_string(LANGUAGE_PL) + " = Polish\n" + std::to_string(LANGUAGE_PL) + " = Polish\n"
+ std::to_string(LANGUAGE_RU) + " = Russian\n" + std::to_string(LANGUAGE_RU) + " = Russian\n"
+ std::to_string(LANGUAGE_CN) + " = Chinese\n"
+ std::to_string(LANGUAGE_CZ) + " = Czech\n"
+ std::to_string(LANGUAGE_ES) + " = Spanish\n"
+ std::to_string(LANGUAGE_HU) + " = Hungarian\n"
+ std::to_string(LANGUAGE_IT) + " = Italian\n"
+ std::to_string(LANGUAGE_JP) + " = Japanese\n"
+ std::to_string(LANGUAGE_TR) + " = Turkish\n"
+ "Add the values to download multiple languages\n" + "Add the values to download multiple languages\n"
+ "All = " + std::to_string(LANGUAGE_EN) + "+" + std::to_string(LANGUAGE_DE) + "+" + std::to_string(LANGUAGE_FR) + "+" + std::to_string(LANGUAGE_PL) + "+" + std::to_string(LANGUAGE_RU) + " = " + "All = " + std::to_string(LANGUAGE_EN | LANGUAGE_DE | LANGUAGE_FR | LANGUAGE_PL | LANGUAGE_RU | LANGUAGE_CN | LANGUAGE_CZ | LANGUAGE_ES | LANGUAGE_HU | LANGUAGE_IT | LANGUAGE_JP | LANGUAGE_TR) + "\n"
+ std::to_string(LANGUAGE_EN | LANGUAGE_DE | LANGUAGE_FR | LANGUAGE_PL | LANGUAGE_RU) + "\n"
+ "French + Polish = " + std::to_string(LANGUAGE_FR) + "+" + std::to_string(LANGUAGE_PL) + " = " + std::to_string(LANGUAGE_FR | LANGUAGE_PL); + "French + Polish = " + std::to_string(LANGUAGE_FR) + "+" + std::to_string(LANGUAGE_PL) + " = " + std::to_string(LANGUAGE_FR | LANGUAGE_PL);
bpo::variables_map vm; bpo::variables_map vm;

View File

@ -301,6 +301,20 @@ gameDetails API::getGameDetails(const std::string& game_name, const unsigned int
installers.push_back(std::make_pair(root["game"]["installer_win_pl"],LANGUAGE_PL)); installers.push_back(std::make_pair(root["game"]["installer_win_pl"],LANGUAGE_PL));
if (lang & LANGUAGE_RU) if (lang & LANGUAGE_RU)
installers.push_back(std::make_pair(root["game"]["installer_win_ru"],LANGUAGE_RU)); installers.push_back(std::make_pair(root["game"]["installer_win_ru"],LANGUAGE_RU));
if (lang & LANGUAGE_CN)
installers.push_back(std::make_pair(root["game"]["installer_win_cn"],LANGUAGE_CN));
if (lang & LANGUAGE_CZ)
installers.push_back(std::make_pair(root["game"]["installer_win_cz"],LANGUAGE_CZ));
if (lang & LANGUAGE_ES)
installers.push_back(std::make_pair(root["game"]["installer_win_es"],LANGUAGE_ES));
if (lang & LANGUAGE_HU)
installers.push_back(std::make_pair(root["game"]["installer_win_hu"],LANGUAGE_HU));
if (lang & LANGUAGE_IT)
installers.push_back(std::make_pair(root["game"]["installer_win_it"],LANGUAGE_IT));
if (lang & LANGUAGE_JP)
installers.push_back(std::make_pair(root["game"]["installer_win_jp"],LANGUAGE_JP));
if (lang & LANGUAGE_TR)
installers.push_back(std::make_pair(root["game"]["installer_win_tr"],LANGUAGE_TR));
} }
if (type & INSTALLER_MAC) if (type & INSTALLER_MAC)
{ {
@ -314,6 +328,20 @@ gameDetails API::getGameDetails(const std::string& game_name, const unsigned int
installers.push_back(std::make_pair(root["game"]["installer_mac_pl"],LANGUAGE_PL)); installers.push_back(std::make_pair(root["game"]["installer_mac_pl"],LANGUAGE_PL));
if (lang & LANGUAGE_RU) if (lang & LANGUAGE_RU)
installers.push_back(std::make_pair(root["game"]["installer_mac_ru"],LANGUAGE_RU)); installers.push_back(std::make_pair(root["game"]["installer_mac_ru"],LANGUAGE_RU));
if (lang & LANGUAGE_CN)
installers.push_back(std::make_pair(root["game"]["installer_mac_cn"],LANGUAGE_CN));
if (lang & LANGUAGE_CZ)
installers.push_back(std::make_pair(root["game"]["installer_mac_cz"],LANGUAGE_CZ));
if (lang & LANGUAGE_ES)
installers.push_back(std::make_pair(root["game"]["installer_mac_es"],LANGUAGE_ES));
if (lang & LANGUAGE_HU)
installers.push_back(std::make_pair(root["game"]["installer_mac_hu"],LANGUAGE_HU));
if (lang & LANGUAGE_IT)
installers.push_back(std::make_pair(root["game"]["installer_mac_it"],LANGUAGE_IT));
if (lang & LANGUAGE_JP)
installers.push_back(std::make_pair(root["game"]["installer_mac_jp"],LANGUAGE_JP));
if (lang & LANGUAGE_TR)
installers.push_back(std::make_pair(root["game"]["installer_mac_tr"],LANGUAGE_TR));
} }
for ( unsigned int i = 0; i < installers.size(); ++i ) for ( unsigned int i = 0; i < installers.size(); ++i )
{ {

View File

@ -275,6 +275,20 @@ void Downloader::fixInstallerLanguagePath(gameDetails& game)
lang = "_pl_"; lang = "_pl_";
else if (game.installers[i].language == LANGUAGE_RU) else if (game.installers[i].language == LANGUAGE_RU)
lang = "_ru_"; lang = "_ru_";
else if (game.installers[i].language == LANGUAGE_CN)
lang = "_cn_";
else if (game.installers[i].language == LANGUAGE_CZ)
lang = "_cz_";
else if (game.installers[i].language == LANGUAGE_ES)
lang = "_es_";
else if (game.installers[i].language == LANGUAGE_HU)
lang = "_hu_";
else if (game.installers[i].language == LANGUAGE_IT)
lang = "_it_";
else if (game.installers[i].language == LANGUAGE_JP)
lang = "_jp_";
else if (game.installers[i].language == LANGUAGE_TR)
lang = "_tr_";
boost::match_results<std::string::const_iterator> what; boost::match_results<std::string::const_iterator> what;
boost::regex expression(lang, boost::regex::perl | boost::regex::icase); boost::regex expression(lang, boost::regex::perl | boost::regex::icase);
if (!boost::regex_search(game.installers[i].path, what, expression)) if (!boost::regex_search(game.installers[i].path, what, expression))