OpenTTD Source 20241224-master-gee860a5c8e
|
Tool to create computer readable (stand-alone) translation files. More...
#include "../stdafx.h"
#include "../core/alloc_func.hpp"
#include "../core/endian_func.hpp"
#include "../core/mem_func.hpp"
#include "../error_func.h"
#include "../string_func.h"
#include "../table/control_codes.h"
#include "strgen.h"
#include "../table/strgen_tables.h"
#include "../safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | Buffer |
The buffer for writing a single string. More... | |
Functions | |
static const CmdStruct * | ParseCommandString (const char **str, std::string ¶m, int *argno, int *casei) |
size_t | Utf8Validate (const char *s) |
void | EmitSingleChar (Buffer *buffer, char *buf, int value) |
bool | ParseRelNum (char **buf, int *value, int *offset) |
char * | ParseWord (char **buf) |
static int | TranslateArgumentIdx (int arg, int offset=0) |
static void | EmitWordList (Buffer *buffer, const std::vector< const char * > &words, uint nw) |
void | EmitPlural (Buffer *buffer, char *buf, int) |
void | EmitGender (Buffer *buffer, char *buf, int) |
static const CmdStruct * | FindCmd (const char *s, int len) |
static uint | ResolveCaseName (const char *str, size_t len) |
ParsedCommandStruct | ExtractCommandString (const char *s, bool) |
const CmdStruct * | TranslateCmdForCompare (const CmdStruct *a) |
static bool | CheckCommandsMatch (const char *a, const char *b, const char *name) |
static void | StripTrailingWhitespace (std::string &str) |
static void | PutArgidxCommand (Buffer *buffer) |
static void | PutCommandString (Buffer *buffer, const char *str) |
Variables | |
static bool | _translated |
Whether the current language is not the master language. | |
static bool | _translation |
Is the current file actually a translation or not. | |
const char * | _file = "(unknown file)" |
The filename of the input, so we can refer to it in errors/warnings. | |
int | _cur_line |
The current line we're parsing in the input file. | |
int | _errors |
int | _warnings |
int | _show_todo |
LanguagePackHeader | _lang |
Header information about a language. | |
static const char * | _cur_ident |
static ParsedCommandStruct | _cur_pcs |
static int | _cur_argidx |
Tool to create computer readable (stand-alone) translation files.
Definition in file strgen_base.cpp.
|
static |
Definition at line 589 of file strgen_base.cpp.
void EmitGender | ( | Buffer * | buffer, |
char * | buf, | ||
int | value | ||
) |
Definition at line 386 of file strgen_base.cpp.
void EmitPlural | ( | Buffer * | buffer, |
char * | buf, | ||
int | value | ||
) |
Definition at line 334 of file strgen_base.cpp.
void EmitSingleChar | ( | Buffer * | buffer, |
char * | buf, | ||
int | value | ||
) |
Definition at line 238 of file strgen_base.cpp.
|
static |
Definition at line 317 of file strgen_base.cpp.
ParsedCommandStruct ExtractCommandString | ( | const char * | s, |
bool | warnings | ||
) |
Definition at line 537 of file strgen_base.cpp.
|
static |
Definition at line 427 of file strgen_base.cpp.
|
static |
Definition at line 451 of file strgen_base.cpp.
bool ParseRelNum | ( | char ** | buf, |
int * | value, | ||
int * | offset | ||
) |
Definition at line 251 of file strgen_base.cpp.
char * ParseWord | ( | char ** | buf | ) |
Definition at line 280 of file strgen_base.cpp.
|
static |
Definition at line 824 of file strgen_base.cpp.
|
static |
Definition at line 831 of file strgen_base.cpp.
|
static |
Definition at line 435 of file strgen_base.cpp.
|
static |
Definition at line 745 of file strgen_base.cpp.
|
static |
Definition at line 799 of file strgen_base.cpp.
Definition at line 570 of file strgen_base.cpp.
size_t Utf8Validate | ( | const char * | s | ) |
Definition at line 213 of file strgen_base.cpp.
|
static |
Definition at line 174 of file strgen_base.cpp.
|
static |
Definition at line 170 of file strgen_base.cpp.
int _cur_line |
The current line we're parsing in the input file.
Definition at line 30 of file strgen_base.cpp.
Referenced by FatalErrorI(), StringReader::ParseFile(), and LanguageWriter::WriteLang().
|
static |
Definition at line 173 of file strgen_base.cpp.
int _errors |
Definition at line 31 of file strgen_base.cpp.
const char* _file = "(unknown file)" |
The filename of the input, so we can refer to it in errors/warnings.
Definition at line 29 of file strgen_base.cpp.
Referenced by FatalErrorI(), and StringReader::ParseFile().
LanguagePackHeader _lang |
Header information about a language.
Definition at line 32 of file strgen_base.cpp.
Referenced by StringReader::HandlePragma(), FileStringReader::HandlePragma(), StringReader::ParseFile(), FileStringReader::ParseFile(), and LanguageWriter::WriteLang().
int _show_todo |
Definition at line 31 of file strgen_base.cpp.
|
static |
Whether the current language is not the master language.
Definition at line 27 of file strgen_base.cpp.
Referenced by LanguageWriter::WriteLang().
|
static |
Is the current file actually a translation or not.
Definition at line 28 of file strgen_base.cpp.
Referenced by StringReader::ParseFile().
int _warnings |
Definition at line 31 of file strgen_base.cpp.