--- a/hedgewars/uSound.pas Mon May 13 21:31:50 2019 +0200
+++ b/hedgewars/uSound.pas Mon May 13 22:51:31 2019 +0200
@@ -336,12 +336,21 @@
function AskForVoicepack(name: shortstring): Pointer;
var i: Longword;
- langName, path: shortstring;
+ tmp, langName, path: shortstring;
begin
i:= 0;
- // Adjust voicepack name if there's a localised version version of the voice
- if cLanguage <> 'en' then
+ { Adjust for language suffix: Voicepacks can have an optional language suffix.
+ It's an underscore followed by an ISO 639-1 or ISO 639-2 language code.
+ The suffix “_qau” is special, it will enable automatic language selection
+ of this voicepack. For example, if team has set Default_qau as voicepack,
+ and the player language is Russian, the actual voicepack will be Default_ru,
+ provided it can be found on the disk.
+ “qau” is a valid ISO 639-2 language code reserved for local use. }
+ tmp:= Copy(name, Length(name) - 3, 4);
+ if (tmp = '_qau') then
+ name:= Copy(name, 1, Length(name) - 4);
+ if (cLanguage <> 'en') and (tmp = '_qau') then
begin
langName:= name+'_'+cLanguage;
path:= cPathz[ptVoices] + '/' + langName;
@@ -1029,7 +1038,7 @@
isSEBackup:= isSoundEnabled;
Volume:= 0;
SoundTimerTicks:= 0;
- defVoicepack:= AskForVoicepack('Default');
+ defVoicepack:= AskForVoicepack('Default_qau');
LastVoiceFailed:= false;
for i:= Low(TSound) to High(TSound) do