mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-02 09:40:35 +00:00
(svn r16145) -Add: '-export-pragmas' to strgen so external tools can (hopefully) automatically be updated to support new pragmas
This commit is contained in:
parent
f64e9ce4a1
commit
3c6ad988fb
@ -1249,6 +1249,15 @@ int CDECL main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "-export-pragmas") == 0) {
|
||||
printf("name\tflags\tdefault\tdescription\n");
|
||||
for (int i = 0; i < lengthof(_pragmas); i++) {
|
||||
printf("\"%s\"\t%s\t\"%s\"\t\"%s\"\n",
|
||||
_pragmas[i][0], _pragmas[i][1], _pragmas[i][2], _pragmas[i][3]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "-t") == 0 || strcmp(argv[1], "--todo") == 0) {
|
||||
_show_todo |= 1;
|
||||
argc--, argv++;
|
||||
@ -1272,6 +1281,7 @@ int CDECL main(int argc, char *argv[])
|
||||
" -d | --dest_dir put output file in the specified directory, create if needed\n"
|
||||
" -export-commands export all commands and exit\n"
|
||||
" -export-plurals export all plural forms and exit\n"
|
||||
" -export-pragmas export all pragmas and exit\n"
|
||||
" Run without parameters and strgen will search for english.txt and parse it,\n"
|
||||
" creating strings.h. Passing an argument, strgen will translate that language\n"
|
||||
" file using english.txt as a reference and output <language>.lng."
|
||||
|
@ -162,3 +162,31 @@ static const PluralForm _plural_forms[] = {
|
||||
{ 2, "Two forms, singular used for everything ending in 1 but not in 11" },
|
||||
{ 3, "Three forms, special case for 1 and 2, 3, or 4" },
|
||||
};
|
||||
|
||||
/* Flags:
|
||||
* 0 = nothing
|
||||
* t = translator editable
|
||||
* l = ltr/rtl choice
|
||||
* p = plural choice
|
||||
* d = separator char (replace spaces with {NBSP})
|
||||
* x1 = hexadecimal number of 1 byte
|
||||
* x2 = hexadecimal number of 2 bytes
|
||||
* g = gender
|
||||
* c = cases
|
||||
* a = array, i.e. list of strings
|
||||
*/
|
||||
/** All pragmas used */
|
||||
static const char *_pragmas[][4] = {
|
||||
/* name flags default description */
|
||||
{ "name", "0", "", "English name for the language" },
|
||||
{ "ownname", "t", "", "Localised name for the language" },
|
||||
{ "isocode", "0", "", "ISO code for the language" },
|
||||
{ "plural", "tp", "0", "Plural form to use" },
|
||||
{ "textdir", "tl", "ltr", "Text direction. Either ltr (left-to-right) or rtl (right-to-left)" },
|
||||
{ "digitsep", "td", ",", "Digit grouping separator for non-currency numbers" },
|
||||
{ "digitsepcur", "td", ",", "Digit grouping seprarator for currency numbers" },
|
||||
{ "winlangid", "x2", "0x0000", "Language ID for Windows" },
|
||||
{ "grflangid", "x1", "0x00", "Language ID for NewGRFs" },
|
||||
{ "gender", "tag", "", "List of genders" },
|
||||
{ "case", "tac", "", "List of cases" },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user