Update tinygettext to match upstream.
We're now ISO on the plural forms (https://github.com/tinygettext/tinygettext/pull/30), so remove the modified warning. We use boost filesystem as <filesystem> and <experimental/filesystem> are not available on the macOS CI yet. (https://github.com/tinygettext/tinygettext/issues/31) Differential Revision: https://code.wildfiregames.com/D3185 This was SVN commit r24342.
This commit is contained in:
parent
421fbfd278
commit
a2f3b25923
@ -20,11 +20,11 @@
|
||||
#ifndef HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP
|
||||
#define HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "dictionary.hpp"
|
||||
#include "language.hpp"
|
||||
@ -42,7 +42,7 @@ private:
|
||||
typedef std::unordered_map<Language, Dictionary*, Language_hash> Dictionaries;
|
||||
Dictionaries dictionaries;
|
||||
|
||||
typedef std::vector<std::string> SearchPath;
|
||||
typedef std::deque<std::string> SearchPath;
|
||||
SearchPath search_path;
|
||||
|
||||
std::string charset;
|
||||
@ -81,8 +81,12 @@ public:
|
||||
void set_charset(const std::string& charset);
|
||||
|
||||
/** Add a directory to the search path for dictionaries, earlier
|
||||
added directories have higher priority then later added ones */
|
||||
void add_directory(const std::string& pathname);
|
||||
added directories have higher priority then later added ones.
|
||||
Set @p precedence to true to invert this for a single addition. */
|
||||
void add_directory(const std::string& pathname, bool precedence = false);
|
||||
|
||||
/** Remove a directory from the search path */
|
||||
void remove_directory(const std::string& pathname);
|
||||
|
||||
/** Return a set of the available languages in their country code */
|
||||
std::set<Language> get_languages();
|
||||
|
@ -22,37 +22,65 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#ifdef TINYGETTEXT_WITH_SDL
|
||||
# include "SDL.h"
|
||||
|
||||
# define tinygettext_ICONV_CONST const
|
||||
# define tinygettext_iconv_t SDL_iconv_t
|
||||
# define tinygettext_iconv SDL_iconv
|
||||
# define tinygettext_iconv_open SDL_iconv_open
|
||||
# define tinygettext_iconv_close SDL_iconv_close
|
||||
#else
|
||||
# include <iconv.h>
|
||||
|
||||
# ifdef HAVE_ICONV_CONST
|
||||
# define tinygettext_ICONV_CONST ICONV_CONST
|
||||
# else
|
||||
# define tinygettext_ICONV_CONST
|
||||
# endif
|
||||
|
||||
# define tinygettext_iconv_t iconv_t
|
||||
# define tinygettext_iconv iconv
|
||||
# define tinygettext_iconv_open iconv_open
|
||||
# define tinygettext_iconv_close iconv_close
|
||||
#endif
|
||||
|
||||
namespace tinygettext {
|
||||
|
||||
namespace detail {
|
||||
struct ConstPtrHack {
|
||||
const char** ptr;
|
||||
inline ConstPtrHack(char** ptr_) : ptr(const_cast<const char**>(ptr_)) {}
|
||||
inline ConstPtrHack(const char** ptr_) : ptr(ptr_) {}
|
||||
inline operator const char**() const { return ptr; }
|
||||
inline operator char**() const { return const_cast<char**>(ptr); }
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
#ifdef TINYGETTEXT_WITH_SDL
|
||||
using iconv_t = ::SDL_iconv_t;
|
||||
#else
|
||||
using iconv_t = ::iconv_t;
|
||||
#endif
|
||||
|
||||
inline iconv_t iconv_open(const char* tocode, const char* fromcode)
|
||||
{
|
||||
#ifdef TINYGETTEXT_WITH_SDL
|
||||
return SDL_iconv_open(tocode, fromcode);
|
||||
#else
|
||||
return ::iconv_open(tocode, fromcode);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline size_t iconv(iconv_t cd,
|
||||
const char** inbuf, size_t* inbytesleft,
|
||||
char** outbuf, size_t* outbytesleft)
|
||||
{
|
||||
#ifdef TINYGETTEXT_WITH_SDL
|
||||
return SDL_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
#else
|
||||
return ::iconv(cd, detail::ConstPtrHack(inbuf), inbytesleft, outbuf, outbytesleft);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int iconv_close(iconv_t cd)
|
||||
{
|
||||
#ifdef TINYGETTEXT_WITH_SDL
|
||||
return SDL_iconv_close(cd);
|
||||
#else
|
||||
return ::iconv_close(cd);
|
||||
#endif
|
||||
}
|
||||
|
||||
class IConv
|
||||
{
|
||||
private:
|
||||
std::string to_charset;
|
||||
std::string from_charset;
|
||||
tinygettext_iconv_t cd;
|
||||
iconv_t cd;
|
||||
|
||||
public:
|
||||
IConv();
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
/** Create an undefined Language object */
|
||||
Language();
|
||||
|
||||
explicit operator bool() const { return language_spec != NULL; }
|
||||
explicit operator bool() const { return language_spec != nullptr; }
|
||||
|
||||
/** Returns the language code (i.e. de, en, fr) */
|
||||
std::string get_language() const;
|
||||
|
@ -27,7 +27,7 @@ namespace tinygettext {
|
||||
// FIXME: very bad to have such things in the API
|
||||
#define log_error if (!Log::log_error_callback); else (Log(Log::log_error_callback)).get()
|
||||
#define log_warning if (!Log::log_warning_callback); else (Log(Log::log_warning_callback)).get()
|
||||
#define log_info if (!Log::log_info_callback); else (Log(Log::log_warning_callback)).get()
|
||||
#define log_info if (!Log::log_info_callback); else (Log(Log::log_info_callback)).get()
|
||||
|
||||
} // namespace tinygettext
|
||||
|
||||
|
@ -36,8 +36,8 @@ public:
|
||||
static PluralForms from_string(const std::string& str);
|
||||
|
||||
PluralForms()
|
||||
: nplural(0),
|
||||
plural(0)
|
||||
: nplural(),
|
||||
plural()
|
||||
{}
|
||||
|
||||
PluralForms(unsigned int nplural_, PluralFunc plural_)
|
||||
@ -48,11 +48,11 @@ public:
|
||||
unsigned int get_nplural() const { return nplural; }
|
||||
unsigned int get_plural(int n) const { if (plural) return plural(n); else return 0; }
|
||||
|
||||
bool operator==(const PluralForms& other) { return nplural == other.nplural && plural == other.plural; }
|
||||
bool operator!=(const PluralForms& other) { return !(*this == other); }
|
||||
bool operator==(const PluralForms& other) const { return nplural == other.nplural && plural == other.plural; }
|
||||
bool operator!=(const PluralForms& other) const { return !(*this == other); }
|
||||
|
||||
explicit operator bool() const {
|
||||
return plural != NULL;
|
||||
return plural != nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,8 +29,8 @@ class UnixFileSystem : public FileSystem
|
||||
public:
|
||||
UnixFileSystem();
|
||||
|
||||
std::vector<std::string> open_directory(const std::string& pathname);
|
||||
std::unique_ptr<std::istream> open_file(const std::string& filename);
|
||||
std::vector<std::string> open_directory(const std::string& pathname) override;
|
||||
std::unique_ptr<std::istream> open_file(const std::string& filename) override;
|
||||
};
|
||||
|
||||
} // namespace tinygettext
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
namespace tinygettext {
|
||||
|
||||
namespace {
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const std::vector<std::string>& v)
|
||||
{
|
||||
for (std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++it)
|
||||
@ -37,6 +39,8 @@ std::ostream& operator<<(std::ostream& o, const std::vector<std::string>& v)
|
||||
return o;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Dictionary::Dictionary(const std::string& charset_) :
|
||||
entries(),
|
||||
ctxt_entries(),
|
||||
|
@ -48,7 +48,7 @@ DictionaryManager::DictionaryManager(const std::string& charset_) :
|
||||
charset(charset_),
|
||||
use_fuzzy(true),
|
||||
current_language(),
|
||||
current_dict(0),
|
||||
current_dict(nullptr),
|
||||
empty_dict(),
|
||||
filesystem(new UnixFileSystem)
|
||||
{
|
||||
@ -71,7 +71,7 @@ DictionaryManager::clear_cache()
|
||||
}
|
||||
dictionaries.clear();
|
||||
|
||||
current_dict = 0;
|
||||
current_dict = nullptr;
|
||||
}
|
||||
|
||||
Dictionary&
|
||||
@ -152,7 +152,7 @@ DictionaryManager::get_dictionary(const Language& language)
|
||||
try
|
||||
{
|
||||
std::unique_ptr<std::istream> in = filesystem->open_file(pofile);
|
||||
if (!in.get())
|
||||
if (!in)
|
||||
{
|
||||
log_error << "error: failure opening: " << pofile << std::endl;
|
||||
}
|
||||
@ -204,7 +204,7 @@ DictionaryManager::set_language(const Language& language)
|
||||
if (current_language != language)
|
||||
{
|
||||
current_language = language;
|
||||
current_dict = 0;
|
||||
current_dict = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,12 +235,26 @@ DictionaryManager::get_use_fuzzy() const
|
||||
}
|
||||
|
||||
void
|
||||
DictionaryManager::add_directory(const std::string& pathname)
|
||||
DictionaryManager::add_directory(const std::string& pathname, bool precedence /* = false */)
|
||||
{
|
||||
clear_cache(); // adding directories invalidates cache
|
||||
if (precedence)
|
||||
search_path.push_front(pathname);
|
||||
else
|
||||
search_path.push_back(pathname);
|
||||
}
|
||||
|
||||
void
|
||||
DictionaryManager::remove_directory(const std::string& pathname)
|
||||
{
|
||||
SearchPath::iterator it = std::find(search_path.begin(), search_path.end(), pathname);
|
||||
if (it != search_path.end())
|
||||
{
|
||||
clear_cache(); // removing directories invalidates cache
|
||||
search_path.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DictionaryManager::set_filesystem(std::unique_ptr<FileSystem> filesystem_)
|
||||
{
|
||||
|
24
source/third_party/tinygettext/src/iconv.cpp
vendored
24
source/third_party/tinygettext/src/iconv.cpp
vendored
@ -32,20 +32,16 @@
|
||||
|
||||
namespace tinygettext {
|
||||
|
||||
#ifndef tinygettext_ICONV_CONST
|
||||
# define tinygettext_ICONV_CONST
|
||||
#endif
|
||||
|
||||
IConv::IConv()
|
||||
: to_charset(),
|
||||
from_charset(),
|
||||
cd(0)
|
||||
cd(nullptr)
|
||||
{}
|
||||
|
||||
IConv::IConv(const std::string& from_charset_, const std::string& to_charset_)
|
||||
: to_charset(),
|
||||
from_charset(),
|
||||
cd(0)
|
||||
cd(nullptr)
|
||||
{
|
||||
set_charsets(from_charset_, to_charset_);
|
||||
}
|
||||
@ -53,14 +49,14 @@ IConv::IConv(const std::string& from_charset_, const std::string& to_charset_)
|
||||
IConv::~IConv()
|
||||
{
|
||||
if (cd)
|
||||
tinygettext_iconv_close(cd);
|
||||
iconv_close(cd);
|
||||
}
|
||||
|
||||
void
|
||||
IConv::set_charsets(const std::string& from_charset_, const std::string& to_charset_)
|
||||
{
|
||||
if (cd)
|
||||
tinygettext_iconv_close(cd);
|
||||
iconv_close(cd);
|
||||
|
||||
from_charset = from_charset_;
|
||||
to_charset = to_charset_;
|
||||
@ -73,12 +69,12 @@ IConv::set_charsets(const std::string& from_charset_, const std::string& to_char
|
||||
|
||||
if (to_charset == from_charset)
|
||||
{
|
||||
cd = 0;
|
||||
cd = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = tinygettext_iconv_open(to_charset.c_str(), from_charset.c_str());
|
||||
if (cd == reinterpret_cast<tinygettext_iconv_t>(-1))
|
||||
cd = iconv_open(to_charset.c_str(), from_charset.c_str());
|
||||
if (cd == reinterpret_cast<iconv_t>(-1))
|
||||
{
|
||||
if(errno == EINVAL)
|
||||
{
|
||||
@ -112,17 +108,17 @@ IConv::convert(const std::string& text)
|
||||
|
||||
// We try to avoid to much copying around, so we write directly into
|
||||
// a std::string
|
||||
tinygettext_ICONV_CONST char* inbuf = const_cast<char*>(&text[0]);
|
||||
const char* inbuf = &text[0];
|
||||
std::string result(outbytesleft, 'X');
|
||||
char* outbuf = &result[0];
|
||||
|
||||
// Try to convert the text.
|
||||
size_t ret = tinygettext_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||
size_t ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||
if (ret == static_cast<size_t>(-1))
|
||||
{
|
||||
if (errno == EILSEQ || errno == EINVAL)
|
||||
{ // invalid multibyte sequence
|
||||
tinygettext_iconv(cd, NULL, NULL, NULL, NULL); // reset state
|
||||
iconv(cd, nullptr, nullptr, nullptr, nullptr); // reset state
|
||||
|
||||
// FIXME: Could try to skip the invalid byte and continue
|
||||
log_error << "error: tinygettext:iconv: invalid multibyte sequence in: \"" << text << "\"" << std::endl;
|
||||
|
486
source/third_party/tinygettext/src/language.cpp
vendored
486
source/third_party/tinygettext/src/language.cpp
vendored
@ -45,249 +45,251 @@ struct LanguageSpec {
|
||||
/** Language Definitions */
|
||||
//*{
|
||||
static const LanguageSpec languages[] = {
|
||||
{ "aa", 0, 0, "Afar" },
|
||||
{ "af", 0, 0, "Afrikaans" },
|
||||
{ "af", "ZA", 0, "Afrikaans (South Africa)" },
|
||||
{ "am", 0, 0, "Amharic" },
|
||||
{ "ar", 0, 0, "Arabic" },
|
||||
{ "ar", "AR", 0, "Arabic (Argentina)" },
|
||||
{ "ar", "OM", 0, "Arabic (Oman)" },
|
||||
{ "ar", "SA", 0, "Arabic (Saudi Arabia)" },
|
||||
{ "ar", "SY", 0, "Arabic (Syrian Arab Republic)" },
|
||||
{ "ar", "TN", 0, "Arabic (Tunisia)" },
|
||||
{ "as", 0, 0, "Assamese" },
|
||||
{ "ast",0, 0, "Asturian" },
|
||||
{ "ay", 0, 0, "Aymara" },
|
||||
{ "az", 0, 0, "Azerbaijani" },
|
||||
{ "az", "IR", 0, "Azerbaijani (Iran)" },
|
||||
{ "be", 0, 0, "Belarusian" },
|
||||
{ "be", 0, "latin", "Belarusian" },
|
||||
{ "bg", 0, 0, "Bulgarian" },
|
||||
{ "bg", "BG", 0, "Bulgarian (Bulgaria)" },
|
||||
{ "bn", 0, 0, "Bengali" },
|
||||
{ "bn", "BD", 0, "Bengali (Bangladesh)" },
|
||||
{ "bn", "IN", 0, "Bengali (India)" },
|
||||
{ "bo", 0, 0, "Tibetan" },
|
||||
{ "br", 0, 0, "Breton" },
|
||||
{ "bs", 0, 0, "Bosnian" },
|
||||
{ "bs", "BA", 0, "Bosnian (Bosnia/Herzegovina)"},
|
||||
{ "bs", "BS", 0, "Bosnian (Bahamas)" },
|
||||
{ "aa", nullptr, nullptr, "Afar" },
|
||||
{ "af", nullptr, nullptr, "Afrikaans" },
|
||||
{ "af", "ZA", nullptr, "Afrikaans (South Africa)" },
|
||||
{ "am", nullptr, nullptr, "Amharic" },
|
||||
{ "ar", nullptr, nullptr, "Arabic" },
|
||||
{ "ar", "AR", nullptr, "Arabic (Argentina)" },
|
||||
{ "ar", "OM", nullptr, "Arabic (Oman)" },
|
||||
{ "ar", "SA", nullptr, "Arabic (Saudi Arabia)" },
|
||||
{ "ar", "SY", nullptr, "Arabic (Syrian Arab Republic)" },
|
||||
{ "ar", "TN", nullptr, "Arabic (Tunisia)" },
|
||||
{ "as", nullptr, nullptr, "Assamese" },
|
||||
{ "ast",nullptr, nullptr, "Asturian" },
|
||||
{ "ay", nullptr, nullptr, "Aymara" },
|
||||
{ "az", nullptr, nullptr, "Azerbaijani" },
|
||||
{ "az", "IR", nullptr, "Azerbaijani (Iran)" },
|
||||
{ "be", nullptr, nullptr, "Belarusian" },
|
||||
{ "be", nullptr, "latin", "Belarusian" },
|
||||
{ "bg", nullptr, nullptr, "Bulgarian" },
|
||||
{ "bg", "BG", nullptr, "Bulgarian (Bulgaria)" },
|
||||
{ "bn", nullptr, nullptr, "Bengali" },
|
||||
{ "bn", "BD", nullptr, "Bengali (Bangladesh)" },
|
||||
{ "bn", "IN", nullptr, "Bengali (India)" },
|
||||
{ "bo", nullptr, nullptr, "Tibetan" },
|
||||
{ "br", nullptr, nullptr, "Breton" },
|
||||
{ "bs", nullptr, nullptr, "Bosnian" },
|
||||
{ "bs", "BA", nullptr, "Bosnian (Bosnia/Herzegovina)"},
|
||||
{ "bs", "BS", nullptr, "Bosnian (Bahamas)" },
|
||||
{ "ca", "ES", "valencia", "Catalan (valencia)" },
|
||||
{ "ca", "ES", 0, "Catalan (Spain)" },
|
||||
{ "ca", 0, "valencia", "Catalan (valencia)" },
|
||||
{ "ca", 0, 0, "Catalan" },
|
||||
{ "cmn", 0, 0, "Mandarin" },
|
||||
{ "co", 0, 0, "Corsican" },
|
||||
{ "cs", 0, 0, "Czech" },
|
||||
{ "cs", "CZ", 0, "Czech (Czech Republic)" },
|
||||
{ "cy", 0, 0, "Welsh" },
|
||||
{ "cy", "GB", 0, "Welsh (Great Britain)" },
|
||||
{ "cz", 0, 0, "Unknown language" },
|
||||
{ "da", 0, 0, "Danish" },
|
||||
{ "da", "DK", 0, "Danish (Denmark)" },
|
||||
{ "de", 0, 0, "German" },
|
||||
{ "de", "AT", 0, "German (Austria)" },
|
||||
{ "de", "CH", 0, "German (Switzerland)" },
|
||||
{ "de", "DE", 0, "German (Germany)" },
|
||||
{ "dk", 0, 0, "Unknown language" },
|
||||
{ "dz", 0, 0, "Dzongkha" },
|
||||
{ "el", 0, 0, "Greek" },
|
||||
{ "el", "GR", 0, "Greek (Greece)" },
|
||||
{ "en", 0, 0, "English" },
|
||||
{ "en", "AU", 0, "English (Australia)" },
|
||||
{ "en", "CA", 0, "English (Canada)" },
|
||||
{ "en", "GB", 0, "English (Great Britain)" },
|
||||
{ "en", "US", 0, "English (United States)" },
|
||||
{ "en", "ZA", 0, "English (South Africa)" },
|
||||
{ "en", 0, "boldquot", "English" },
|
||||
{ "en", 0, "quot", "English" },
|
||||
{ "ca", "ES", nullptr, "Catalan (Spain)" },
|
||||
{ "ca", nullptr, "valencia", "Catalan (valencia)" },
|
||||
{ "ca", nullptr, nullptr, "Catalan" },
|
||||
{ "cmn", nullptr, nullptr, "Mandarin" },
|
||||
{ "co", nullptr, nullptr, "Corsican" },
|
||||
{ "cs", nullptr, nullptr, "Czech" },
|
||||
{ "cs", "CZ", nullptr, "Czech (Czech Republic)" },
|
||||
{ "cy", nullptr, nullptr, "Welsh" },
|
||||
{ "cy", "GB", nullptr, "Welsh (Great Britain)" },
|
||||
{ "cz", nullptr, nullptr, "Unknown language" },
|
||||
{ "da", nullptr, nullptr, "Danish" },
|
||||
{ "da", "DK", nullptr, "Danish (Denmark)" },
|
||||
{ "de", nullptr, nullptr, "German" },
|
||||
{ "de", "AT", nullptr, "German (Austria)" },
|
||||
{ "de", "CH", nullptr, "German (Switzerland)" },
|
||||
{ "de", "DE", nullptr, "German (Germany)" },
|
||||
{ "dk", nullptr, nullptr, "Unknown language" },
|
||||
{ "dz", nullptr, nullptr, "Dzongkha" },
|
||||
{ "el", nullptr, nullptr, "Greek" },
|
||||
{ "el", "GR", nullptr, "Greek (Greece)" },
|
||||
{ "en", nullptr, nullptr, "English" },
|
||||
{ "en", "AU", nullptr, "English (Australia)" },
|
||||
{ "en", "CA", nullptr, "English (Canada)" },
|
||||
{ "en", "GB", nullptr, "English (Great Britain)" },
|
||||
{ "en", "US", nullptr, "English (United States)" },
|
||||
{ "en", "ZA", nullptr, "English (South Africa)" },
|
||||
{ "en", nullptr, "boldquot", "English" },
|
||||
{ "en", nullptr, "quot", "English" },
|
||||
{ "en", "US", "piglatin", "English" },
|
||||
{ "eo", 0, 0, "Esperanto" },
|
||||
{ "es", 0, 0, "Spanish" },
|
||||
{ "es", "AR", 0, "Spanish (Argentina)" },
|
||||
{ "es", "CL", 0, "Spanish (Chile)" },
|
||||
{ "es", "CO", 0, "Spanish (Colombia)" },
|
||||
{ "es", "CR", 0, "Spanish (Costa Rica)" },
|
||||
{ "es", "DO", 0, "Spanish (Dominican Republic)"},
|
||||
{ "es", "EC", 0, "Spanish (Ecuador)" },
|
||||
{ "es", "ES", 0, "Spanish (Spain)" },
|
||||
{ "es", "GT", 0, "Spanish (Guatemala)" },
|
||||
{ "es", "HN", 0, "Spanish (Honduras)" },
|
||||
{ "es", "LA", 0, "Spanish (Laos)" },
|
||||
{ "es", "MX", 0, "Spanish (Mexico)" },
|
||||
{ "es", "NI", 0, "Spanish (Nicaragua)" },
|
||||
{ "es", "PA", 0, "Spanish (Panama)" },
|
||||
{ "es", "PE", 0, "Spanish (Peru)" },
|
||||
{ "es", "PR", 0, "Spanish (Puerto Rico)" },
|
||||
{ "es", "SV", 0, "Spanish (El Salvador)" },
|
||||
{ "es", "UY", 0, "Spanish (Uruguay)" },
|
||||
{ "es", "VE", 0, "Spanish (Venezuela)" },
|
||||
{ "et", 0, 0, "Estonian" },
|
||||
{ "et", "EE", 0, "Estonian (Estonia)" },
|
||||
{ "et", "ET", 0, "Estonian (Ethiopia)" },
|
||||
{ "eu", 0, 0, "Basque" },
|
||||
{ "eu", "ES", 0, "Basque (Spain)" },
|
||||
{ "fa", 0, 0, "Persian" },
|
||||
{ "fa", "AF", 0, "Persian (Afghanistan)" },
|
||||
{ "fa", "IR", 0, "Persian (Iran)" },
|
||||
{ "fi", 0, 0, "Finnish" },
|
||||
{ "fi", "FI", 0, "Finnish (Finland)" },
|
||||
{ "fo", 0, 0, "Faroese" },
|
||||
{ "fo", "FO", 0, "Faeroese (Faroe Islands)" },
|
||||
{ "fr", 0, 0, "French" },
|
||||
{ "fr", "CA", 0, "French (Canada)" },
|
||||
{ "fr", "CH", 0, "French (Switzerland)" },
|
||||
{ "fr", "FR", 0, "French (France)" },
|
||||
{ "fr", "LU", 0, "French (Luxembourg)" },
|
||||
{ "fy", 0, 0, "Frisian" },
|
||||
{ "ga", 0, 0, "Irish" },
|
||||
{ "gd", 0, 0, "Gaelic Scots" },
|
||||
{ "gl", 0, 0, "Galician" },
|
||||
{ "gl", "ES", 0, "Galician (Spain)" },
|
||||
{ "gn", 0, 0, "Guarani" },
|
||||
{ "gu", 0, 0, "Gujarati" },
|
||||
{ "gv", 0, 0, "Manx" },
|
||||
{ "ha", 0, 0, "Hausa" },
|
||||
{ "he", 0, 0, "Hebrew" },
|
||||
{ "he", "IL", 0, "Hebrew (Israel)" },
|
||||
{ "hi", 0, 0, "Hindi" },
|
||||
{ "hr", 0, 0, "Croatian" },
|
||||
{ "hr", "HR", 0, "Croatian (Croatia)" },
|
||||
{ "hu", 0, 0, "Hungarian" },
|
||||
{ "hu", "HU", 0, "Hungarian (Hungary)" },
|
||||
{ "hy", 0, 0, "Armenian" },
|
||||
{ "ia", 0, 0, "Interlingua" },
|
||||
{ "id", 0, 0, "Indonesian" },
|
||||
{ "id", "ID", 0, "Indonesian (Indonesia)" },
|
||||
{ "is", 0, 0, "Icelandic" },
|
||||
{ "is", "IS", 0, "Icelandic (Iceland)" },
|
||||
{ "it", 0, 0, "Italian" },
|
||||
{ "it", "CH", 0, "Italian (Switzerland)" },
|
||||
{ "it", "IT", 0, "Italian (Italy)" },
|
||||
{ "iu", 0, 0, "Inuktitut" },
|
||||
{ "ja", 0, 0, "Japanese" },
|
||||
{ "ja", "JP", 0, "Japanese (Japan)" },
|
||||
{ "ka", 0, 0, "Georgian" },
|
||||
{ "kk", 0, 0, "Kazakh" },
|
||||
{ "kl", 0, 0, "Kalaallisut" },
|
||||
{ "km", 0, 0, "Khmer" },
|
||||
{ "km", "KH", 0, "Khmer (Cambodia)" },
|
||||
{ "kn", 0, 0, "Kannada" },
|
||||
{ "ko", 0, 0, "Korean" },
|
||||
{ "ko", "KR", 0, "Korean (Korea)" },
|
||||
{ "ku", 0, 0, "Kurdish" },
|
||||
{ "kw", 0, 0, "Cornish" },
|
||||
{ "ky", 0, 0, "Kirghiz" },
|
||||
{ "la", 0, 0, "Latin" },
|
||||
{ "lo", 0, 0, "Lao" },
|
||||
{ "lt", 0, 0, "Lithuanian" },
|
||||
{ "lt", "LT", 0, "Lithuanian (Lithuania)" },
|
||||
{ "lv", 0, 0, "Latvian" },
|
||||
{ "lv", "LV", 0, "Latvian (Latvia)" },
|
||||
{ "jbo", 0, 0, "Lojban" },
|
||||
{ "mg", 0, 0, "Malagasy" },
|
||||
{ "mi", 0, 0, "Maori" },
|
||||
{ "mk", 0, 0, "Macedonian" },
|
||||
{ "mk", "MK", 0, "Macedonian (Macedonia)" },
|
||||
{ "ml", 0, 0, "Malayalam" },
|
||||
{ "mn", 0, 0, "Mongolian" },
|
||||
{ "mr", 0, 0, "Marathi" },
|
||||
{ "ms", 0, 0, "Malay" },
|
||||
{ "ms", "MY", 0, "Malay (Malaysia)" },
|
||||
{ "mt", 0, 0, "Maltese" },
|
||||
{ "my", 0, 0, "Burmese" },
|
||||
{ "my", "MM", 0, "Burmese (Myanmar)" },
|
||||
{ "nb", 0, 0, "Norwegian Bokmal" },
|
||||
{ "nb", "NO", 0, "Norwegian Bokmål (Norway)" },
|
||||
{ "ne", 0, 0, "Nepali" },
|
||||
{ "nl", 0, 0, "Dutch" },
|
||||
{ "nl", "BE", 0, "Dutch (Belgium)" },
|
||||
{ "nl", "NL", 0, "Dutch (Netherlands)" },
|
||||
{ "nn", 0, 0, "Norwegian Nynorsk" },
|
||||
{ "nn", "NO", 0, "Norwegian Nynorsk (Norway)" },
|
||||
{ "no", 0, 0, "Norwegian" },
|
||||
{ "no", "NO", 0, "Norwegian (Norway)" },
|
||||
{ "no", "NY", 0, "Norwegian (NY)" },
|
||||
{ "nr", 0, 0, "Ndebele, South" },
|
||||
{ "oc", 0, 0, "Occitan post 1500" },
|
||||
{ "om", 0, 0, "Oromo" },
|
||||
{ "or", 0, 0, "Oriya" },
|
||||
{ "pa", 0, 0, "Punjabi" },
|
||||
{ "pl", 0, 0, "Polish" },
|
||||
{ "pl", "PL", 0, "Polish (Poland)" },
|
||||
{ "ps", 0, 0, "Pashto" },
|
||||
{ "pt", 0, 0, "Portuguese" },
|
||||
{ "pt", "BR", 0, "Portuguese (Brazil)" },
|
||||
{ "pt", "PT", 0, "Portuguese (Portugal)" },
|
||||
{ "qu", 0, 0, "Quechua" },
|
||||
{ "rm", 0, 0, "Rhaeto-Romance" },
|
||||
{ "ro", 0, 0, "Romanian" },
|
||||
{ "ro", "RO", 0, "Romanian (Romania)" },
|
||||
{ "ru", 0, 0, "Russian" },
|
||||
{ "ru", "RU", 0, "Russian (Russia" },
|
||||
{ "rw", 0, 0, "Kinyarwanda" },
|
||||
{ "sa", 0, 0, "Sanskrit" },
|
||||
{ "sd", 0, 0, "Sindhi" },
|
||||
{ "se", 0, 0, "Sami" },
|
||||
{ "se", "NO", 0, "Sami (Norway)" },
|
||||
{ "si", 0, 0, "Sinhalese" },
|
||||
{ "sk", 0, 0, "Slovak" },
|
||||
{ "sk", "SK", 0, "Slovak (Slovakia)" },
|
||||
{ "sl", 0, 0, "Slovenian" },
|
||||
{ "sl", "SI", 0, "Slovenian (Slovenia)" },
|
||||
{ "sl", "SL", 0, "Slovenian (Sierra Leone)" },
|
||||
{ "sm", 0, 0, "Samoan" },
|
||||
{ "so", 0, 0, "Somali" },
|
||||
{ "sp", 0, 0, "Unknown language" },
|
||||
{ "sq", 0, 0, "Albanian" },
|
||||
{ "sq", "AL", 0, "Albanian (Albania)" },
|
||||
{ "sr", 0, 0, "Serbian" },
|
||||
{ "sr", "YU", 0, "Serbian (Yugoslavia)" },
|
||||
{ "sr", 0,"ije", "Serbian" },
|
||||
{ "sr", 0, "latin", "Serbian" },
|
||||
{ "sr", 0, "Latn", "Serbian" },
|
||||
{ "ss", 0, 0, "Swati" },
|
||||
{ "st", 0, 0, "Sotho" },
|
||||
{ "sv", 0, 0, "Swedish" },
|
||||
{ "sv", "SE", 0, "Swedish (Sweden)" },
|
||||
{ "sv", "SV", 0, "Swedish (El Salvador)" },
|
||||
{ "sw", 0, 0, "Swahili" },
|
||||
{ "ta", 0, 0, "Tamil" },
|
||||
{ "te", 0, 0, "Telugu" },
|
||||
{ "tg", 0, 0, "Tajik" },
|
||||
{ "th", 0, 0, "Thai" },
|
||||
{ "th", "TH", 0, "Thai (Thailand)" },
|
||||
{ "ti", 0, 0, "Tigrinya" },
|
||||
{ "tk", 0, 0, "Turkmen" },
|
||||
{ "tl", 0, 0, "Tagalog" },
|
||||
{ "to", 0, 0, "Tonga" },
|
||||
{ "tr", 0, 0, "Turkish" },
|
||||
{ "tr", "TR", 0, "Turkish (Turkey)" },
|
||||
{ "ts", 0, 0, "Tsonga" },
|
||||
{ "tt", 0, 0, "Tatar" },
|
||||
{ "ug", 0, 0, "Uighur" },
|
||||
{ "uk", 0, 0, "Ukrainian" },
|
||||
{ "uk", "UA", 0, "Ukrainian (Ukraine)" },
|
||||
{ "ur", 0, 0, "Urdu" },
|
||||
{ "ur", "PK", 0, "Urdu (Pakistan)" },
|
||||
{ "uz", 0, 0, "Uzbek" },
|
||||
{ "uz", 0, "cyrillic", "Uzbek" },
|
||||
{ "vi", 0, 0, "Vietnamese" },
|
||||
{ "vi", "VN", 0, "Vietnamese (Vietnam)" },
|
||||
{ "wa", 0, 0, "Walloon" },
|
||||
{ "wo", 0, 0, "Wolof" },
|
||||
{ "xh", 0, 0, "Xhosa" },
|
||||
{ "yi", 0, 0, "Yiddish" },
|
||||
{ "yo", 0, 0, "Yoruba" },
|
||||
{ "zh", 0, 0, "Chinese" },
|
||||
{ "zh", "CN", 0, "Chinese (simplified)" },
|
||||
{ "zh", "HK", 0, "Chinese (Hong Kong)" },
|
||||
{ "zh", "TW", 0, "Chinese (traditional)" },
|
||||
{ "zu", 0, 0, "Zulu" },
|
||||
{ NULL, 0, 0, NULL }
|
||||
{ "eo", nullptr, nullptr, "Esperanto" },
|
||||
{ "es", nullptr, nullptr, "Spanish" },
|
||||
{ "es", "AR", nullptr, "Spanish (Argentina)" },
|
||||
{ "es", "CL", nullptr, "Spanish (Chile)" },
|
||||
{ "es", "CO", nullptr, "Spanish (Colombia)" },
|
||||
{ "es", "CR", nullptr, "Spanish (Costa Rica)" },
|
||||
{ "es", "DO", nullptr, "Spanish (Dominican Republic)"},
|
||||
{ "es", "EC", nullptr, "Spanish (Ecuador)" },
|
||||
{ "es", "ES", nullptr, "Spanish (Spain)" },
|
||||
{ "es", "GT", nullptr, "Spanish (Guatemala)" },
|
||||
{ "es", "HN", nullptr, "Spanish (Honduras)" },
|
||||
{ "es", "LA", nullptr, "Spanish (Laos)" },
|
||||
{ "es", "MX", nullptr, "Spanish (Mexico)" },
|
||||
{ "es", "NI", nullptr, "Spanish (Nicaragua)" },
|
||||
{ "es", "PA", nullptr, "Spanish (Panama)" },
|
||||
{ "es", "PE", nullptr, "Spanish (Peru)" },
|
||||
{ "es", "PR", nullptr, "Spanish (Puerto Rico)" },
|
||||
{ "es", "SV", nullptr, "Spanish (El Salvador)" },
|
||||
{ "es", "UY", nullptr, "Spanish (Uruguay)" },
|
||||
{ "es", "VE", nullptr, "Spanish (Venezuela)" },
|
||||
{ "et", nullptr, nullptr, "Estonian" },
|
||||
{ "et", "EE", nullptr, "Estonian (Estonia)" },
|
||||
{ "et", "ET", nullptr, "Estonian (Ethiopia)" },
|
||||
{ "eu", nullptr, nullptr, "Basque" },
|
||||
{ "eu", "ES", nullptr, "Basque (Spain)" },
|
||||
{ "fa", nullptr, nullptr, "Persian" },
|
||||
{ "fa", "AF", nullptr, "Persian (Afghanistan)" },
|
||||
{ "fa", "IR", nullptr, "Persian (Iran)" },
|
||||
{ "fi", nullptr, nullptr, "Finnish" },
|
||||
{ "fi", "FI", nullptr, "Finnish (Finland)" },
|
||||
{ "fo", nullptr, nullptr, "Faroese" },
|
||||
{ "fo", "FO", nullptr, "Faeroese (Faroe Islands)" },
|
||||
{ "fr", nullptr, nullptr, "French" },
|
||||
{ "fr", "CA", nullptr, "French (Canada)" },
|
||||
{ "fr", "CH", nullptr, "French (Switzerland)" },
|
||||
{ "fr", "FR", nullptr, "French (France)" },
|
||||
{ "fr", "LU", nullptr, "French (Luxembourg)" },
|
||||
{ "fy", nullptr, nullptr, "Frisian" },
|
||||
{ "ga", nullptr, nullptr, "Irish" },
|
||||
{ "gd", nullptr, nullptr, "Gaelic Scots" },
|
||||
{ "gl", nullptr, nullptr, "Galician" },
|
||||
{ "gl", "ES", nullptr, "Galician (Spain)" },
|
||||
{ "gn", nullptr, nullptr, "Guarani" },
|
||||
{ "gu", nullptr, nullptr, "Gujarati" },
|
||||
{ "gv", nullptr, nullptr, "Manx" },
|
||||
{ "ha", nullptr, nullptr, "Hausa" },
|
||||
{ "he", nullptr, nullptr, "Hebrew" },
|
||||
{ "he", "IL", nullptr, "Hebrew (Israel)" },
|
||||
{ "hi", nullptr, nullptr, "Hindi" },
|
||||
{ "hr", nullptr, nullptr, "Croatian" },
|
||||
{ "hr", "HR", nullptr, "Croatian (Croatia)" },
|
||||
{ "hu", nullptr, nullptr, "Hungarian" },
|
||||
{ "hu", "HU", nullptr, "Hungarian (Hungary)" },
|
||||
{ "hy", nullptr, nullptr, "Armenian" },
|
||||
{ "ia", nullptr, nullptr, "Interlingua" },
|
||||
{ "id", nullptr, nullptr, "Indonesian" },
|
||||
{ "id", "ID", nullptr, "Indonesian (Indonesia)" },
|
||||
{ "is", nullptr, nullptr, "Icelandic" },
|
||||
{ "is", "IS", nullptr, "Icelandic (Iceland)" },
|
||||
{ "it", nullptr, nullptr, "Italian" },
|
||||
{ "it", "CH", nullptr, "Italian (Switzerland)" },
|
||||
{ "it", "IT", nullptr, "Italian (Italy)" },
|
||||
{ "iu", nullptr, nullptr, "Inuktitut" },
|
||||
{ "ja", nullptr, nullptr, "Japanese" },
|
||||
{ "ja", "JP", nullptr, "Japanese (Japan)" },
|
||||
{ "ka", nullptr, nullptr, "Georgian" },
|
||||
{ "kk", nullptr, nullptr, "Kazakh" },
|
||||
{ "kl", nullptr, nullptr, "Kalaallisut" },
|
||||
{ "km", nullptr, nullptr, "Khmer" },
|
||||
{ "km", "KH", nullptr, "Khmer (Cambodia)" },
|
||||
{ "kn", nullptr, nullptr, "Kannada" },
|
||||
{ "ko", nullptr, nullptr, "Korean" },
|
||||
{ "ko", "KR", nullptr, "Korean (Korea)" },
|
||||
{ "ku", nullptr, nullptr, "Kurdish" },
|
||||
{ "kw", nullptr, nullptr, "Cornish" },
|
||||
{ "ky", nullptr, nullptr, "Kirghiz" },
|
||||
{ "la", nullptr, nullptr, "Latin" },
|
||||
{ "lo", nullptr, nullptr, "Lao" },
|
||||
{ "lt", nullptr, nullptr, "Lithuanian" },
|
||||
{ "lt", "LT", nullptr, "Lithuanian (Lithuania)" },
|
||||
{ "lv", nullptr, nullptr, "Latvian" },
|
||||
{ "lv", "LV", nullptr, "Latvian (Latvia)" },
|
||||
{ "jbo", nullptr, nullptr, "Lojban" },
|
||||
{ "mg", nullptr, nullptr, "Malagasy" },
|
||||
{ "mi", nullptr, nullptr, "Maori" },
|
||||
{ "mk", nullptr, nullptr, "Macedonian" },
|
||||
{ "mk", "MK", nullptr, "Macedonian (Macedonia)" },
|
||||
{ "ml", nullptr, nullptr, "Malayalam" },
|
||||
{ "mn", nullptr, nullptr, "Mongolian" },
|
||||
{ "mr", nullptr, nullptr, "Marathi" },
|
||||
{ "ms", nullptr, nullptr, "Malay" },
|
||||
{ "ms", "MY", nullptr, "Malay (Malaysia)" },
|
||||
{ "mt", nullptr, nullptr, "Maltese" },
|
||||
{ "my", nullptr, nullptr, "Burmese" },
|
||||
{ "my", "MM", nullptr, "Burmese (Myanmar)" },
|
||||
{ "nb", nullptr, nullptr, "Norwegian Bokmal" },
|
||||
{ "nb", "NO", nullptr, "Norwegian Bokmål (Norway)" },
|
||||
{ "ne", nullptr, nullptr, "Nepali" },
|
||||
{ "nl", nullptr, nullptr, "Dutch" },
|
||||
{ "nl", "BE", nullptr, "Dutch (Belgium)" },
|
||||
{ "nl", "NL", nullptr, "Dutch (Netherlands)" },
|
||||
{ "nn", nullptr, nullptr, "Norwegian Nynorsk" },
|
||||
{ "nn", "NO", nullptr, "Norwegian Nynorsk (Norway)" },
|
||||
{ "no", nullptr, nullptr, "Norwegian" },
|
||||
{ "no", "NO", nullptr, "Norwegian (Norway)" },
|
||||
{ "no", "NY", nullptr, "Norwegian (NY)" },
|
||||
{ "nr", nullptr, nullptr, "Ndebele, South" },
|
||||
{ "oc", nullptr, nullptr, "Occitan post 15nullptrnullptr" },
|
||||
{ "om", nullptr, nullptr, "Oromo" },
|
||||
{ "or", nullptr, nullptr, "Oriya" },
|
||||
{ "pa", nullptr, nullptr, "Punjabi" },
|
||||
{ "pl", nullptr, nullptr, "Polish" },
|
||||
{ "pl", "PL", nullptr, "Polish (Poland)" },
|
||||
{ "ps", nullptr, nullptr, "Pashto" },
|
||||
{ "pt", nullptr, nullptr, "Portuguese" },
|
||||
{ "pt", "BR", nullptr, "Portuguese (Brazil)" },
|
||||
{ "pt", "PT", nullptr, "Portuguese (Portugal)" },
|
||||
{ "qu", nullptr, nullptr, "Quechua" },
|
||||
{ "rm", nullptr, nullptr, "Rhaeto-Romance" },
|
||||
{ "ro", nullptr, nullptr, "Romanian" },
|
||||
{ "ro", "RO", nullptr, "Romanian (Romania)" },
|
||||
{ "ru", nullptr, nullptr, "Russian" },
|
||||
{ "ru", "RU", nullptr, "Russian (Russia" },
|
||||
{ "rw", nullptr, nullptr, "Kinyarwanda" },
|
||||
{ "sa", nullptr, nullptr, "Sanskrit" },
|
||||
{ "sd", nullptr, nullptr, "Sindhi" },
|
||||
{ "se", nullptr, nullptr, "Sami" },
|
||||
{ "se", "NO", nullptr, "Sami (Norway)" },
|
||||
{ "si", nullptr, nullptr, "Sinhalese" },
|
||||
{ "sk", nullptr, nullptr, "Slovak" },
|
||||
{ "sk", "SK", nullptr, "Slovak (Slovakia)" },
|
||||
{ "sl", nullptr, nullptr, "Slovenian" },
|
||||
{ "sl", "SI", nullptr, "Slovenian (Slovenia)" },
|
||||
{ "sl", "SL", nullptr, "Slovenian (Sierra Leone)" },
|
||||
{ "sm", nullptr, nullptr, "Samoan" },
|
||||
{ "so", nullptr, nullptr, "Somali" },
|
||||
{ "sp", nullptr, nullptr, "Unknown language" },
|
||||
{ "sq", nullptr, nullptr, "Albanian" },
|
||||
{ "sq", "AL", nullptr, "Albanian (Albania)" },
|
||||
{ "sr", nullptr, nullptr, "Serbian" },
|
||||
{ "sr", "YU", nullptr, "Serbian (Yugoslavia)" },
|
||||
{ "sr", nullptr,"ije", "Serbian" },
|
||||
{ "sr", nullptr, "latin", "Serbian" },
|
||||
{ "sr", nullptr, "Latn", "Serbian" },
|
||||
{ "ss", nullptr, nullptr, "Swati" },
|
||||
{ "st", nullptr, nullptr, "Sotho" },
|
||||
{ "sv", nullptr, nullptr, "Swedish" },
|
||||
{ "sv", "SE", nullptr, "Swedish (Sweden)" },
|
||||
{ "sv", "SV", nullptr, "Swedish (El Salvador)" },
|
||||
{ "sw", nullptr, nullptr, "Swahili" },
|
||||
{ "ta", nullptr, nullptr, "Tamil" },
|
||||
{ "te", nullptr, nullptr, "Telugu" },
|
||||
{ "tg", nullptr, nullptr, "Tajik" },
|
||||
{ "th", nullptr, nullptr, "Thai" },
|
||||
{ "th", "TH", nullptr, "Thai (Thailand)" },
|
||||
{ "ti", nullptr, nullptr, "Tigrinya" },
|
||||
{ "tk", nullptr, nullptr, "Turkmen" },
|
||||
{ "tl", nullptr, nullptr, "Tagalog" },
|
||||
{ "to", nullptr, nullptr, "Tonga" },
|
||||
{ "tr", nullptr, nullptr, "Turkish" },
|
||||
{ "tr", "TR", nullptr, "Turkish (Turkey)" },
|
||||
{ "ts", nullptr, nullptr, "Tsonga" },
|
||||
{ "tt", nullptr, nullptr, "Tatar" },
|
||||
{ "ug", nullptr, nullptr, "Uighur" },
|
||||
{ "uk", nullptr, nullptr, "Ukrainian" },
|
||||
{ "uk", "UA", nullptr, "Ukrainian (Ukraine)" },
|
||||
{ "ur", nullptr, nullptr, "Urdu" },
|
||||
{ "ur", "PK", nullptr, "Urdu (Pakistan)" },
|
||||
{ "uz", nullptr, nullptr, "Uzbek" },
|
||||
{ "uz", nullptr, "cyrillic", "Uzbek" },
|
||||
{ "vi", nullptr, nullptr, "Vietnamese" },
|
||||
{ "vi", "VN", nullptr, "Vietnamese (Vietnam)" },
|
||||
{ "wa", nullptr, nullptr, "Walloon" },
|
||||
{ "wo", nullptr, nullptr, "Wolof" },
|
||||
{ "xh", nullptr, nullptr, "Xhosa" },
|
||||
{ "yi", nullptr, nullptr, "Yiddish" },
|
||||
{ "yo", nullptr, nullptr, "Yoruba" },
|
||||
{ "zh", nullptr, nullptr, "Chinese" },
|
||||
{ "zh", "CN", nullptr, "Chinese (simplified)" },
|
||||
{ "zh", "HK", nullptr, "Chinese (Hong Kong)" },
|
||||
{ "zh", "TW", nullptr, "Chinese (traditional)" },
|
||||
{ "zu", nullptr, nullptr, "Zulu" },
|
||||
{ nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
//*}
|
||||
|
||||
namespace {
|
||||
|
||||
std::string
|
||||
resolve_language_alias(const std::string& name)
|
||||
{
|
||||
@ -366,6 +368,8 @@ resolve_language_alias(const std::string& name)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Language
|
||||
Language::from_spec(const std::string& language, const std::string& country, const std::string& modifier)
|
||||
{
|
||||
@ -374,7 +378,7 @@ Language::from_spec(const std::string& language, const std::string& country, con
|
||||
|
||||
if (language_map.empty())
|
||||
{ // Init language_map
|
||||
for(int i = 0; languages[i].language != NULL; ++i)
|
||||
for(int i = 0; languages[i].language != nullptr; ++i)
|
||||
language_map[languages[i].language].push_back(&languages[i]);
|
||||
}
|
||||
|
||||
@ -389,7 +393,7 @@ Language::from_spec(const std::string& language, const std::string& country, con
|
||||
tmpspec.modifier = modifier.c_str();
|
||||
Language tmplang(&tmpspec);
|
||||
|
||||
const LanguageSpec* best_match = 0;
|
||||
const LanguageSpec* best_match = nullptr;
|
||||
int best_match_score = 0;
|
||||
for(std::vector<const LanguageSpec*>::iterator j = lst.begin(); j != lst.end(); ++j)
|
||||
{ // Search for the language that best matches the given spec, value country more then modifier
|
||||
@ -457,7 +461,7 @@ Language::Language(const LanguageSpec* language_spec_)
|
||||
}
|
||||
|
||||
Language::Language()
|
||||
: language_spec(0)
|
||||
: language_spec()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Slightly modified version by Wildfire Games, for 0 A.D to support more languages.
|
||||
*/
|
||||
|
||||
// tinygettext - A gettext replacement that works directly on .po files
|
||||
// Copyright (c) 2006 Ingo Ruhnke <grumbel@gmail.com>
|
||||
//
|
||||
@ -29,6 +25,8 @@
|
||||
|
||||
namespace tinygettext {
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* Plural functions are used to select a string that matches a given
|
||||
* count. \a n is the count and the return value is the string index
|
||||
@ -63,6 +61,7 @@ unsigned int plural4_uk(int n) { return static_cast<unsigned int>(n % 1 == 0 &&
|
||||
unsigned int plural5_ga(int n) { return static_cast<unsigned int>(n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4);}
|
||||
unsigned int plural6_ar(int n) { return static_cast<unsigned int>( n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5); }
|
||||
|
||||
} // namespace
|
||||
|
||||
PluralForms
|
||||
PluralForms::from_string(const std::string& str)
|
||||
|
@ -310,10 +310,7 @@ POParser::is_empty_line()
|
||||
}
|
||||
else if (current_line[0] == '#')
|
||||
{ // handle comments as empty lines
|
||||
if (current_line.size() == 1 || (current_line.size() >= 2 && isspace(current_line[1])))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (current_line.size() == 1 || (current_line.size() >= 2 && isspace(current_line[1])));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -440,7 +437,7 @@ POParser::parse()
|
||||
dict.add_translation(msgid, msgid_plural, msgstr_num);
|
||||
}
|
||||
|
||||
if (0)
|
||||
if ((false))
|
||||
{
|
||||
std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl;
|
||||
std::cout << "msgid \"" << msgid << "\"" << std::endl;
|
||||
@ -469,7 +466,7 @@ POParser::parse()
|
||||
dict.add_translation(msgid, conv.convert(msgstr));
|
||||
}
|
||||
|
||||
if (0)
|
||||
if ((false))
|
||||
{
|
||||
std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl;
|
||||
std::cout << "msgid \"" << msgid << "\"" << std::endl;
|
||||
|
@ -1,3 +1,6 @@
|
||||
/*
|
||||
* Slightly modified version by Wildfire Games, for 0 A.D to support macOS 10.13
|
||||
*/
|
||||
// tinygettext - A gettext replacement that works directly on .po files
|
||||
// Copyright (c) 2009 Ingo Ruhnke <grumbel@gmail.com>
|
||||
//
|
||||
@ -21,16 +24,9 @@
|
||||
|
||||
#include "tinygettext/unix_file_system.hpp"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <fstream>
|
||||
#ifdef _MSC_VER
|
||||
// MSVC doesn't include dirent.h, so we use this emulated win32 version
|
||||
# include "win32/dirent.h"
|
||||
#else
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace tinygettext {
|
||||
|
||||
@ -40,32 +36,19 @@ UnixFileSystem::UnixFileSystem()
|
||||
|
||||
std::vector<std::string>
|
||||
UnixFileSystem::open_directory(const std::string& pathname)
|
||||
{
|
||||
DIR* dir = opendir(pathname.c_str());
|
||||
if (!dir)
|
||||
{
|
||||
// FIXME: error handling
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> files;
|
||||
|
||||
struct dirent* dp;
|
||||
while((dp = readdir(dir)) != 0)
|
||||
for(auto const& p : boost::filesystem::directory_iterator(pathname))
|
||||
{
|
||||
files.push_back(dp->d_name);
|
||||
files.push_back(p.path().filename().string());
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
return files;
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<std::istream>
|
||||
UnixFileSystem::open_file(const std::string& filename)
|
||||
{
|
||||
return std::unique_ptr<std::istream>(new std::ifstream(filename.c_str()));
|
||||
return std::unique_ptr<std::istream>(new std::ifstream(filename));
|
||||
}
|
||||
|
||||
} // namespace tinygettext
|
||||
|
Loading…
Reference in New Issue
Block a user