diff --git a/data/CREDITS b/data/CREDITS index cc5187368..988542d6f 100644 Binary files a/data/CREDITS and b/data/CREDITS differ diff --git a/src/states_screens/credits.cpp b/src/states_screens/credits.cpp index ca0b6baab..b8af375ef 100644 --- a/src/states_screens/credits.cpp +++ b/src/states_screens/credits.cpp @@ -207,21 +207,34 @@ void CreditsScreen::loadedFromFile() return; } - std::vector translator = - StringUtils::split(_("translator-credits"), '\n'); - m_sections.push_back( new CreditsSection("Launchpad translations")); - for(unsigned int i = 1; i < translator.size(); i = i + 4) + + irr::core::stringw translators_credits = _("translator-credits"); + + if (translators_credits != L"translator-credits") { - line = stringw("Translations"); - CreditsEntry entry(line); - getCurrentSection()->addEntry( entry ); - - for(unsigned int j = 0; i + j < translator.size() && j < 4; j ++) + std::vector translator = + StringUtils::split(translators_credits, '\n'); + + m_sections.push_back( new CreditsSection("Translations")); + for(unsigned int i = 1; i < translator.size(); i = i + 4) { - getCurrentSection()->addSubEntry(translator[i + j]); + line = stringw(translations->getCurrentLanguageName().c_str()); + CreditsEntry entry(line); + getCurrentSection()->addEntry( entry ); + + for(unsigned int j = 0; i + j < translator.size() && j < 6; j ++) + { + getCurrentSection()->addSubEntry(translator[i + j]); + } } + assert(m_sections.size() > 0); + + // FIXME for testing only + m_sections.swap( m_sections.size() - 1, 0 ); + + // translations should be just before the last screen + //m_sections.swap( m_sections.size() - 1, m_sections.size() - 2 ); } - assert(m_sections.size() > 0); } // loadedFromFile diff --git a/src/utils/translation.cpp b/src/utils/translation.cpp index b0b6a4d4e..3fddb1998 100644 --- a/src/utils/translation.cpp +++ b/src/utils/translation.cpp @@ -223,6 +223,8 @@ Translations::Translations() //: m_dictionary_manager("UTF-16") } } + m_current_language_name = l.get_name(); + if (!l) { m_dictionary = m_dictionary_manager.get_dictionary(); @@ -233,12 +235,16 @@ Translations::Translations() //: m_dictionary_manager("UTF-16") std::cout << "[translate] Env var LANGUAGE = '" << language << "', which corresponds to '" << Language::from_env(language).get_name() << "'\n"; + + m_current_language_name = Language::from_env(language).get_name() ; + m_dictionary = m_dictionary_manager.get_dictionary( Language::from_env(language) ); } } else { + m_current_language_name = "Default language"; m_dictionary = m_dictionary_manager.get_dictionary(); } @@ -404,3 +410,9 @@ bool Translations::isRTLLanguage() const return m_rtl; } +std::string Translations::getCurrentLanguageName() +{ + return m_current_language_name; + //return m_dictionary_manager.get_language().get_name(); +} + diff --git a/src/utils/translation.hpp b/src/utils/translation.hpp index 7aae797cd..d3854397f 100644 --- a/src/utils/translation.hpp +++ b/src/utils/translation.hpp @@ -46,6 +46,8 @@ private: irr::core::stringw m_converted_string; bool m_rtl; + std::string m_current_language_name; + public: Translations(); @@ -57,6 +59,8 @@ public: const wchar_t* fribidize(const irr::core::stringw &str) { return fribidize(str.c_str()); } const std::vector* getLanguageList() const; + + std::string getCurrentLanguageName(); }; // Translations