- changed title to Determine language for string table imports from ini-file
Determine language for string table imports from ini-file
Issue #25
resolved
SkyProc knows where the Skyrim.ini is found and this file contains a line:
sLanguage=GERMAN
So it would a simple task to parse the ini-file for the language to use, with a simple code like this:
FileReader fstream = new FileReader(SPGlobal.getSkyrimINI());
BufferedReader reader = new BufferedReader(fstream);
String line = reader.readLine();
while (line != null) {
if (line.contains("sLanguage")){
String language = line.substring(line.indexOf("=")+1);
for (SPGlobal.Language lang: SPGlobal.Language.values()) {
if (lang.name().equalsIgnoreCase(language)) {
SPGlobal.language = lang;
SPGlobal.logMain("LANGUAGE", SPGlobal.language + " (extracted from ini)");
break;
}
}
}
line = reader.readLine();
}
Sorry for not submitting this as a simple pull request, I do not know the internals of SkyProc well enough to decide where I should place this. :)
Comments (5)
-
reporter -
repo owner That's a good idea.
-
reporter - edited description
- removed a left-over debug statement from the example code
- rearranged debug-overview output statement in example
I just wanted to add, that it would be helpful to print the finally chosen language (i.e. when the import really starts) to the Debug Overview. :)
-
repo owner Added Language SPGlobal.getLanguageFromSkyrimIni(), SPGlobal.language will be set to that unless a language is passed as a parameter with -Language. Also added the language to the debug overview.
-
repo owner - changed status to resolved
Will be in 2.2.0.7
- Log in to comment
fixed typo in summary