mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Added support for French translation.
This commit is contained in:
@@ -77,6 +77,7 @@ const unsigned int boss_lang_any = boss::g_lang_any;
|
||||
const unsigned int boss_lang_english = boss::g_lang_english;
|
||||
const unsigned int boss_lang_spanish = boss::g_lang_spanish;
|
||||
const unsigned int boss_lang_russian = boss::g_lang_russian;
|
||||
const unsigned int boss_lang_french = boss::g_lang_french; ///< Tells the API to preferentially select French messages.
|
||||
|
||||
// BOSS cleanliness codes.
|
||||
const unsigned int boss_needs_cleaning_no = 0;
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ BOSS_API extern const unsigned int boss_lang_any; ///< Tells the API to select
|
||||
BOSS_API extern const unsigned int boss_lang_english; ///< Tells the API to preferentially select English messages.
|
||||
BOSS_API extern const unsigned int boss_lang_spanish; ///< Tells the API to preferentially select Spanish messages.
|
||||
BOSS_API extern const unsigned int boss_lang_russian; ///< Tells the API to preferentially select Russian messages.
|
||||
|
||||
BOSS_API extern const unsigned int boss_lang_french; ///< Tells the API to preferentially select French messages.
|
||||
///@}
|
||||
|
||||
/*********************************//**
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace boss {
|
||||
const unsigned int g_lang_english = 1;
|
||||
const unsigned int g_lang_spanish = 2;
|
||||
const unsigned int g_lang_russian = 3;
|
||||
const unsigned int g_lang_french = 4;
|
||||
|
||||
//Version numbers.
|
||||
const unsigned int g_version_major = 3;
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace boss {
|
||||
extern const unsigned int g_lang_english;
|
||||
extern const unsigned int g_lang_spanish;
|
||||
extern const unsigned int g_lang_russian;
|
||||
extern const unsigned int g_lang_french;
|
||||
|
||||
//Version numbers.
|
||||
extern const unsigned int g_version_major;
|
||||
|
||||
@@ -239,6 +239,8 @@ namespace boss {
|
||||
return "spa";
|
||||
else if (num == g_lang_russian)
|
||||
return "rus";
|
||||
else if (num == g_lang_french)
|
||||
return "fra";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
@@ -250,6 +252,8 @@ namespace boss {
|
||||
return g_lang_spanish;
|
||||
else if (boost::iequals(str, "rus"))
|
||||
return g_lang_russian;
|
||||
else if (boost::iequals(str, "fra"))
|
||||
return g_lang_french;
|
||||
else
|
||||
return g_lang_any;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1035,7 +1035,7 @@ MessageEditDialog::MessageEditDialog(wxWindow *parent, const wxString& title) :
|
||||
|
||||
//Initialise controls.
|
||||
_type = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 3, Type);
|
||||
_language = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, Language);
|
||||
_language = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, LanguageSize, Language);
|
||||
|
||||
_condition = new wxTextCtrl(this, wxID_ANY);
|
||||
_str = new wxTextCtrl(this, wxID_ANY);
|
||||
|
||||
+8
-3
@@ -27,11 +27,12 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/locale.hpp>
|
||||
|
||||
wxString Language[4] = {
|
||||
const wxString Language[LanguageSize] = {
|
||||
translate("None Specified"),
|
||||
wxT("English"),
|
||||
wxString::FromUTF8("Español"),
|
||||
wxString::FromUTF8("Русский"),
|
||||
wxString::FromUTF8("Français"),
|
||||
};
|
||||
|
||||
wxString translate(const std::string& str) {
|
||||
@@ -53,6 +54,8 @@ unsigned int GetLangIndex(const std::string& str) {
|
||||
return 2;
|
||||
else if (boost::iequals(str, "rus"))
|
||||
return 3;
|
||||
else if (boost::iequals(str, "fra"))
|
||||
return 4;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -64,12 +67,14 @@ std::string GetLangStringFromIndex(const unsigned int index) {
|
||||
return "spa";
|
||||
else if (index == 3)
|
||||
return "rus";
|
||||
else if (index == 4)
|
||||
return "fra";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
unsigned int GetLangNum(const wxString& str) {
|
||||
for (int i=0; i < 4; ++i) {
|
||||
for (int i = 0; i < LanguageSize; ++i) {
|
||||
if (str == Language[i])
|
||||
return GetLangNum(GetLangStringFromIndex(i));
|
||||
}
|
||||
@@ -77,7 +82,7 @@ unsigned int GetLangNum(const wxString& str) {
|
||||
}
|
||||
|
||||
unsigned int GetLangIndex(const wxString& str) {
|
||||
for (int i=0; i < 4; ++i) {
|
||||
for (int i = 0; i < LanguageSize; ++i) {
|
||||
if (str == Language[i])
|
||||
return i;
|
||||
}
|
||||
|
||||
+3
-1
@@ -74,7 +74,9 @@ enum {
|
||||
BUTTON_MoveDown,
|
||||
};
|
||||
|
||||
extern wxString Language[4];
|
||||
const unsigned int LanguageSize = 5;
|
||||
|
||||
extern const wxString Language[LanguageSize];
|
||||
|
||||
wxString translate(const std::string& str);
|
||||
|
||||
|
||||
@@ -249,6 +249,11 @@ bool BossGUI::OnInit() {
|
||||
localeId = "ru.UTF-8";
|
||||
lang = wxLANGUAGE_RUSSIAN;
|
||||
}
|
||||
else if (_settings["Language"].as<string>() == "fra") {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Selected language: French.";
|
||||
localeId = "fr.UTF-8";
|
||||
lang = wxLANGUAGE_FRENCH;
|
||||
}
|
||||
}
|
||||
|
||||
//Boost.Locale initialisation: Specify location of language dictionaries.
|
||||
|
||||
@@ -51,7 +51,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
|
||||
|
||||
//Initialise controls.
|
||||
GameChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Games);
|
||||
LanguageChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, Language);
|
||||
LanguageChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, LanguageSize, Language);
|
||||
DebugVerbosityChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, DebugVerbosity);
|
||||
|
||||
gamesList = new wxListView(this, LIST_Games, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL);
|
||||
|
||||
Reference in New Issue
Block a user