Removes tinygettext from the L10n header.
Noticed By: nwtour This was SVN commit r25041.
This commit is contained in:
parent
533e78b2e5
commit
d6ddc4f3ac
@ -24,12 +24,8 @@
|
||||
|
||||
#include "i18n/L10n.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "gui/GUIManager.h"
|
||||
#include "lib/external_libraries/tinygettext.h"
|
||||
#include "lib/file/file_system.h"
|
||||
#include "lib/utf8.h"
|
||||
#include "ps/CLogger.h"
|
||||
@ -37,11 +33,49 @@
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/GameSetup/GameSetup.h"
|
||||
|
||||
static Status ReloadChangedFileCB(void* param, const VfsPath& path)
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
Status ReloadChangedFileCB(void* param, const VfsPath& path)
|
||||
{
|
||||
return static_cast<L10n*>(param)->ReloadChangedFile(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the specified content of a PO file into the specified dictionary.
|
||||
*
|
||||
* Used by LoadDictionaryForCurrentLocale() to add entries to the game
|
||||
* translations @link dictionary.
|
||||
*
|
||||
* @param poContent Content of a PO file as a string.
|
||||
* @param dictionary Dictionary where the entries from the PO file should be
|
||||
* stored.
|
||||
*/
|
||||
void ReadPoIntoDictionary(const std::string& poContent, tinygettext::Dictionary* dictionary)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::istringstream inputStream(poContent);
|
||||
tinygettext::POParser::parse("virtual PO file", inputStream, *dictionary);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOGERROR("[Localization] Exception while reading virtual PO file: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void L10n::DictionaryDeleter::operator()(tinygettext::Dictionary* dictionary)
|
||||
{
|
||||
delete dictionary;
|
||||
}
|
||||
|
||||
L10n::L10n()
|
||||
: m_Dictionary(new tinygettext::Dictionary()), currentLocaleIsOriginalGameLocale(false), useLongStrings(false)
|
||||
{
|
||||
@ -518,19 +552,6 @@ void L10n::LoadListOfAvailableLocales()
|
||||
}
|
||||
}
|
||||
|
||||
void L10n::ReadPoIntoDictionary(const std::string& poContent, tinygettext::Dictionary* dictionary) const
|
||||
{
|
||||
try
|
||||
{
|
||||
std::istringstream inputStream(poContent);
|
||||
tinygettext::POParser::parse("virtual PO file", inputStream, *dictionary);
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
LOGERROR("[Localization] Exception while reading virtual PO file: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
icu::DateFormat* L10n::CreateDateTimeInstance(const L10n::DateTimeType& type, const icu::DateFormat::EStyle& style, const icu::Locale& locale) const
|
||||
{
|
||||
switch(type)
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "lib/code_annotation.h"
|
||||
#include "lib/external_libraries/icu.h"
|
||||
#include "lib/external_libraries/tinygettext.h"
|
||||
#include "lib/file/vfs/vfs_path.h"
|
||||
#include "ps/Singleton.h"
|
||||
|
||||
@ -33,6 +32,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace tinygettext
|
||||
{
|
||||
class Dictionary;
|
||||
}
|
||||
|
||||
#define g_L10n L10n::GetSingleton()
|
||||
|
||||
/**
|
||||
@ -475,6 +479,10 @@ public:
|
||||
Status ReloadChangedFile(const VfsPath& path);
|
||||
|
||||
private:
|
||||
struct DictionaryDeleter
|
||||
{
|
||||
void operator()(tinygettext::Dictionary* dictionary);
|
||||
};
|
||||
|
||||
/**
|
||||
* Dictionary that contains the translations for the
|
||||
@ -483,7 +491,7 @@ private:
|
||||
*
|
||||
* @sa LoadDictionaryForCurrentLocale()
|
||||
*/
|
||||
std::unique_ptr<tinygettext::Dictionary> m_Dictionary;
|
||||
std::unique_ptr<tinygettext::Dictionary, DictionaryDeleter> m_Dictionary;
|
||||
|
||||
/**
|
||||
* Locale that the game is currently using.
|
||||
@ -556,18 +564,6 @@ private:
|
||||
*/
|
||||
void LoadListOfAvailableLocales();
|
||||
|
||||
/**
|
||||
* Loads the specified content of a PO file into the specified dictionary.
|
||||
*
|
||||
* Used by LoadDictionaryForCurrentLocale() to add entries to the game
|
||||
* translations @link dictionary.
|
||||
*
|
||||
* @param poContent Content of a PO file as a string.
|
||||
* @param dictionary Dictionary where the entries from the PO file should be
|
||||
* stored.
|
||||
*/
|
||||
void ReadPoIntoDictionary(const std::string& poContent, tinygettext::Dictionary* dictionary) const;
|
||||
|
||||
/**
|
||||
* Creates an ICU date formatted with the specified settings.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user