loadLanguages static method
Loads the supported languages for the given Inno Setup executable path.
Scans the installation directory containing innoPath for
Default.isl (English) and every Languages/*.isl file, and replaces
the previously cached set. This is the only way to populate all.
Implementation
static void loadLanguages(String innoPath) {
final innoDir = File(innoPath).parent;
final languagesDir = Directory(p.join(innoDir.path, "Languages"));
final languages = <Language>[];
// for English, the default language.
if (File(p.join(innoDir.path, "Default.isl")).existsSync()) {
languages.add(Language._("English", "Default.isl"));
}
// rest of the languages are in the Languages directory.
if (languagesDir.existsSync()) {
languagesDir
.listSync()
.where((file) => file is File && file.path.endsWith(".isl"))
.forEach((file) {
final fileName = p.basename(file.path);
final fileStem = p.basenameWithoutExtension(fileName);
languages.add(Language._(fileStem, "Languages\\${fileName}"));
});
}
_cachedLangs = languages;
}