equal
deleted
inserted
replaced
52 int caseidx; |
52 int caseidx; |
53 char *string; |
53 char *string; |
54 struct Case *next; |
54 struct Case *next; |
55 } Case; |
55 } Case; |
56 |
56 |
57 static bool _masterlang; |
57 static bool _translated; |
58 static const char* _file = "(unknown file)"; |
58 static const char* _file = "(unknown file)"; |
59 static int _cur_line; |
59 static int _cur_line; |
60 static int _errors, _warnings; |
60 static int _errors, _warnings; |
61 |
61 |
62 typedef struct LangString { |
62 typedef struct LangString { |
330 |
330 |
331 if (nw == 0) |
331 if (nw == 0) |
332 Fatal("%s: No plural words", _cur_ident); |
332 Fatal("%s: No plural words", _cur_ident); |
333 |
333 |
334 if (_plural_form_counts[_lang_pluralform] != nw) |
334 if (_plural_form_counts[_lang_pluralform] != nw) |
335 if (_masterlang) { |
335 if (_translated) { |
336 Fatal("%s: Invalid number of plural forms. Expecting %d, found %d.", _cur_ident, |
336 Fatal("%s: Invalid number of plural forms. Expecting %d, found %d.", _cur_ident, |
337 _plural_form_counts[_lang_pluralform], nw); |
337 _plural_form_counts[_lang_pluralform], nw); |
338 } else { |
338 } else { |
339 Warning("'%s' is untranslated. Tweaking english string to allow compilation for plural forms", _cur_ident); |
339 Warning("'%s' is untranslated. Tweaking english string to allow compilation for plural forms", _cur_ident); |
340 if (nw > _plural_form_counts[_lang_pluralform]) { |
340 if (nw > _plural_form_counts[_lang_pluralform]) { |
1155 } else { |
1155 } else { |
1156 casep = ls->english_case; |
1156 casep = ls->english_case; |
1157 cmdp = ls->english; |
1157 cmdp = ls->english; |
1158 } |
1158 } |
1159 |
1159 |
|
1160 _translated = !(cmdp == ls->english); |
|
1161 |
1160 if (casep) { |
1162 if (casep) { |
1161 Case *c; |
1163 Case *c; |
1162 int num; |
1164 int num; |
1163 // Need to output a case-switch. |
1165 // Need to output a case-switch. |
1164 // It has this format |
1166 // It has this format |
1222 argc--, argv++; |
1224 argc--, argv++; |
1223 } |
1225 } |
1224 |
1226 |
1225 |
1227 |
1226 if (argc == 1) { |
1228 if (argc == 1) { |
1227 _masterlang = true; |
|
1228 // parse master file |
1229 // parse master file |
1229 ParseFile("lang/english.txt", true); |
1230 ParseFile("lang/english.txt", true); |
1230 MakeHashOfStrings(); |
1231 MakeHashOfStrings(); |
1231 if (_errors) return 1; |
1232 if (_errors) return 1; |
1232 |
1233 |
1234 |
1235 |
1235 WriteLangfile("lang/english.lng", 0); |
1236 WriteLangfile("lang/english.lng", 0); |
1236 WriteStringsH("table/strings.h"); |
1237 WriteStringsH("table/strings.h"); |
1237 |
1238 |
1238 } else if (argc == 2) { |
1239 } else if (argc == 2) { |
1239 _masterlang = false; |
|
1240 ParseFile("lang/english.txt", true); |
1240 ParseFile("lang/english.txt", true); |
1241 MakeHashOfStrings(); |
1241 MakeHashOfStrings(); |
1242 ParseFile(argv[1], false); |
1242 ParseFile(argv[1], false); |
1243 |
1243 |
1244 if (_errors) return 1; |
1244 if (_errors) return 1; |