From a29bbb1e1f8d6525746dd31cd5e47159d896cc84 Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 12 Aug 2009 01:28:11 +0000 Subject: (svn r17157) -Add: localised decimal separator --- src/strgen/strgen.cpp | 6 ++++++ src/strgen/strgen.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/strgen') diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index e8f8de50b..d5213107f 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -74,6 +74,7 @@ static uint32 _hash; static char _lang_name[32], _lang_ownname[32], _lang_isocode[16]; static char _lang_digit_group_separator[8]; static char _lang_digit_group_separator_currency[8]; +static char _lang_digit_decimal_separator[8]; static byte _lang_pluralform; static byte _lang_textdir; static uint16 _lang_winlangid; @@ -533,6 +534,9 @@ static void HandlePragma(char *str) } else if (!memcmp(str, "digitsepcur ", 12)) { str += 12; strecpy(_lang_digit_group_separator_currency, strcmp(str, "{NBSP}") == 0 ? "\xC2\xA0" : str, lastof(_lang_digit_group_separator_currency)); + } else if (!memcmp(str, "decimalsep ", 11)) { + str += 11; + strecpy(_lang_digit_decimal_separator, strcmp(str, "{NBSP}") == 0 ? "\xC2\xA0" : str, lastof(_lang_digit_decimal_separator)); } else if (!memcmp(str, "winlangid ", 10)) { const char *buf = str + 10; long langid = strtol(buf, NULL, 16); @@ -817,6 +821,7 @@ static void ParseFile(const char *file, bool english) _lang_name[0] = _lang_ownname[0] = _lang_isocode[0] = '\0'; strecpy(_lang_digit_group_separator, ",", lastof(_lang_digit_group_separator)); strecpy(_lang_digit_group_separator_currency, ",", lastof(_lang_digit_group_separator_currency)); + strecpy(_lang_digit_decimal_separator, ".", lastof(_lang_digit_decimal_separator)); _lang_textdir = TD_LTR; _lang_winlangid = 0x0000; // neutral language code _lang_newgrflangid = 0; // standard english @@ -1069,6 +1074,7 @@ static void WriteLangfile(const char *filename) strecpy(hdr.isocode, _lang_isocode, lastof(hdr.isocode)); strecpy(hdr.digit_group_separator, _lang_digit_group_separator, lastof(hdr.digit_group_separator)); strecpy(hdr.digit_group_separator_currency, _lang_digit_group_separator_currency, lastof(hdr.digit_group_separator_currency)); + strecpy(hdr.digit_decimal_separator, _lang_digit_decimal_separator, lastof(hdr.digit_decimal_separator)); fwrite(&hdr, sizeof(hdr), 1, f); diff --git a/src/strgen/strgen.h b/src/strgen/strgen.h index 290ee1232..4014f227c 100644 --- a/src/strgen/strgen.h +++ b/src/strgen/strgen.h @@ -18,6 +18,8 @@ struct LanguagePackHeader { char digit_group_separator[8]; /** Thousand separator used for currencies */ char digit_group_separator_currency[8]; + /** Decimal separator */ + char digit_decimal_separator[8]; byte plural_form; ///< plural form index byte text_dir; ///< default direction of the text /** -- cgit v1.2.3-70-g09d2