--- a/QTfrontend/util/namegen.cpp Mon May 13 23:44:00 2019 +0200
+++ b/QTfrontend/util/namegen.cpp Tue May 14 01:03:23 2019 +0200
@@ -228,6 +228,11 @@
team.setHedgehog(HedgehogNumber, hh);
}
+void HWNamegen::teamLocalizedDefaultVoice(HWTeam & team)
+{
+ team.setVoicepack(getLocalizedDefaultVoice());
+}
+
QStringList HWNamegen::dictContents(const QString filename)
{
QStringList list;
@@ -488,3 +493,26 @@
//pick a random voice
return Voices[rand()%(Voices.size())];
}
+
+QString HWNamegen::getLocalizedDefaultVoice()
+{
+ QStringList entries = DataManager::instance().entryList(
+ "Sounds/voices",
+ QDir::Dirs | QDir::NoDotAndDotDot,
+ QStringList("*"),
+ false);
+
+ QString loc = QLocale().name();
+ if(entries.contains("Default_" + loc))
+ {
+ return QString("Default_" + loc);
+ }
+ else if(entries.contains("Default_" + loc.left(2)))
+ {
+ return QString("Default_" + loc.left(2));
+ }
+ else
+ {
+ return QString("Default");
+ }
+}