mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-27 13:33:29 +01:00
Linux/MacOSX: Only load valid XML language files (Language.langid.xml format with langid one of the predefined language identifiers)
This commit is contained in:
parent
380ca35c6d
commit
d6f0250901
@ -130,16 +130,25 @@ namespace VeraCrypt
|
||||
|
||||
if (wxDir::Exists(languagesFolder.GetName())) {
|
||||
size_t langCount;
|
||||
langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
|
||||
langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, "*.xml", wxDIR_FILES);
|
||||
for (size_t i = 0; i < langCount; ++i) {
|
||||
wxFileName filename(langArray[i]);
|
||||
wxString langId = filename.GetName().AfterLast('.');
|
||||
|
||||
// Get the name part of the file (without extension)
|
||||
wxString basename = filename.GetName();
|
||||
|
||||
// Check if the basename matches the pattern "Language.langId"
|
||||
if (basename.StartsWith("Language.")) {
|
||||
wxString langId = basename.AfterFirst('.');
|
||||
|
||||
// Verify if the language ID exists in langEntries map
|
||||
wxString langNative = langEntries[langId];
|
||||
if (!langNative.empty()) {
|
||||
LanguageListBox->Append(langNative);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user