Tinygettext now works with windows.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/tinygettext@7957 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-03-16 23:43:26 +00:00
parent 090fc12b5c
commit 8ae5d8e5f3
8 changed files with 124 additions and 12 deletions

View File

@ -233,7 +233,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib user32.lib gdi32.lib winmm.lib advapi32.lib OpenAL32.lib libogg.lib libvorbis.lib libvorbisfile.lib intl.lib Irrlicht.lib ws2_32.lib fribidi.lib pthreadVC2.lib libcurld_imp.lib"
AdditionalDependencies="opengl32.lib user32.lib gdi32.lib winmm.lib advapi32.lib OpenAL32.lib libogg.lib libvorbis.lib libvorbisfile.lib Irrlicht.lib ws2_32.lib fribidi.lib pthreadVC2.lib libcurld_imp.lib"
OutputFile="./../../../$(ProjectName)_curl_d.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../dependencies/lib"
@ -1155,6 +1155,46 @@
>
</File>
</Filter>
<Filter
Name="tinygettext"
>
<File
RelativePath="..\..\tinygettext\dictionary.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\dictionary_manager.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\iconv.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\language.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\log.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\plural_forms.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\po_parser.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\stk_file_system.cpp"
>
</File>
<File
RelativePath="..\..\tinygettext\tinygettext.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Headerdateien"
@ -1396,10 +1436,30 @@
RelativePath="..\..\utils\translation.hpp"
>
</File>
<File
RelativePath="..\..\utils\utf8.h"
>
</File>
<File
RelativePath="..\..\utils\vec3.hpp"
>
</File>
<Filter
Name="utf8"
>
<File
RelativePath="..\..\utils\utf8\checked.h"
>
</File>
<File
RelativePath="..\..\utils\utf8\core.h"
>
</File>
<File
RelativePath="..\..\utils\utf8\unchecked.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="audio"
@ -2101,6 +2161,54 @@
>
</File>
</Filter>
<Filter
Name="tinygettext"
>
<File
RelativePath="..\..\tinygettext\dictionary.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\dictionary_manager.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\file_system.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\iconv.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\language.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\log.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\log_stream.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\plural_forms.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\po_parser.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\stk_file_system.hpp"
>
</File>
<File
RelativePath="..\..\tinygettext\tinygettext.hpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Ressourcendateien"

View File

@ -220,7 +220,8 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
if (selection == "system")
{
#ifdef WIN32
SetEnvironmentVariableA("LANGUAGE", "");
SetEnvironmentVariable("LANGUAGE", "");
_putenv("LANGUAGE=");
#else
setenv( "LANGUAGE", "", 1);
#endif
@ -228,7 +229,8 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
else
{
#ifdef WIN32
SetEnvironmentVariableA("LANGUAGE", selection.c_str());
std::string s=std::string("LANGUAGE=")+selection.c_str();
_putenv(s.c_str());
#else
setenv("LANGUAGE", selection.c_str(), 1);
#endif

View File

@ -55,7 +55,7 @@ public:
/** Create an undefined Language object */
Language();
operator bool() const { return language_spec; }
operator bool() const { return language_spec!=NULL; }
/** Returns the language code (i.e. de, en, fr) */
std::string get_language() const;

View File

@ -46,7 +46,7 @@ unsigned int plural4_ar(int n) { return static_cast<unsigned int>( n==1 ? 0 : n=
PluralForms
PluralForms::from_string(const std::string& str)
{
static std::map<std::string, struct PluralForms> plural_forms;
static std::map<std::string, class PluralForms> plural_forms;
if (plural_forms.empty())
{
@ -73,7 +73,7 @@ PluralForms::from_string(const std::string& str)
if (!isspace(str[i]))
space_less_str += str[i];
std::map<std::string, struct PluralForms>::const_iterator it= plural_forms.find(space_less_str);
std::map<std::string, class PluralForms>::const_iterator it= plural_forms.find(space_less_str);
if (it != plural_forms.end())
{
return it->second;

View File

@ -50,7 +50,7 @@ public:
bool operator!=(const PluralForms& other) { return !(*this == other); }
operator bool() const {
return plural;
return plural!=NULL;
}
};

View File

@ -336,9 +336,9 @@ POParser::parse()
// skip UTF-8 intro that some text editors produce
// see http://en.wikipedia.org/wiki/Byte-order_mark
if (current_line.size() >= 3 &&
current_line[0] == static_cast<char>(0xef) &&
current_line[1] == static_cast<char>(0xbb) &&
current_line[2] == static_cast<char>(0xbf))
current_line[0] == static_cast<unsigned char>(0xef) &&
current_line[1] == static_cast<unsigned char>(0xbb) &&
current_line[2] == static_cast<unsigned char>(0xbf))
{
current_line = current_line.substr(3);
}

View File

@ -54,7 +54,11 @@ private:
void get_string_line(std::ostringstream& str,unsigned int skip);
bool is_empty_line();
bool prefix(const char* );
#ifdef WIN32
void error(const std::string& msg);
#else
void error(const std::string& msg) __attribute__((__noreturn__));
#endif
void warning(const std::string& msg);
public:

View File

@ -19,9 +19,7 @@
#include <sys/types.h>
#include <fstream>
#include <dirent.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
#include "io/file_manager.hpp"