Move hard-coded gender pronouns from TextManager to Texts.xml

This commit is contained in:
Joonas Rikkonen
2017-12-28 21:47:29 +02:00
parent 9dd4d21cac
commit 4d55e2dd55
3 changed files with 38 additions and 20 deletions

View File

@@ -85,6 +85,14 @@
<DeleteDialogQuestion>Are you sure you want to delete "[file]"?</DeleteDialogQuestion>
<DeleteFileError>Could not delete file "[file]"!</DeleteFileError>
<!-- Pronouns -->
<PronounMale>He</PronounMale>
<PronounPossessiveMale>His</PronounPossessiveMale>
<PronounReflexiveMale>Himself</PronounReflexiveMale>
<PronounFemale>She</PronounFemale>
<PronounPossessiveFemale>Her</PronounPossessiveFemale>
<PronounReflexiveFemale>Herself</PronounReflexiveFemale>
<!-- Mission info -->
<NoMission>No mission</NoMission>
<MissionReward>Reward: [reward]</MissionReward>
@@ -243,12 +251,12 @@
<TraitorMoreAgentsMessage>It is possible that there are other agents on this submarine. You don't know their names, but you do have a method of communication. Use the code words to greet the agent and code response to respond. Disguise such words in a normal-looking phrase so the crew doesn't suspect anything.\n\nThe code words are: [codewords].\nThe code response is: [coderesponse].</TraitorMoreAgentsMessage>
<TraitorStartMessageServer>[traitorname] is the traitor and the target is [targetname].</TraitorStartMessageServer>
<TraitorEndMessageSuccess>[traitorname] was a traitor! [Gendernounpossessive] task was to assassinate [targetname]. The task was successful.</TraitorEndMessageSuccess>
<TraitorEndMessageSuccessTraitorDead>[traitorname] was a traitor! [Gendernounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor did not make it out alive either.</TraitorEndMessageSuccessTraitorDead>
<TraitorEndMessageSuccessTraitorDetained>[traitorname] was a traitor! [Gendernounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor was succesfully detained.</TraitorEndMessageSuccessTraitorDetained>
<TraitorEndMessageFailure>[traitorname] was a traitor! [Gendernounpossessive] task was to assassinate [targetname]. The task was unsuccessful.</TraitorEndMessageFailure>
<TraitorEndMessageFailureTraitorDead>[traitorname] was a traitor! [Gendernounpossessive] task was to assassinate [targetname], but [gendernoun] got [gendernounreflexive] killed before completing it.</TraitorEndMessageFailureTraitorDead>
<TraitorEndMessageFailureTraitorDetained>[traitorname] was a traitor! [Gendernounpossessive] task was to assassinate [targetname]. The task failed - [gendernoun] was successfully detained.</TraitorEndMessageFailureTraitorDetained>
<TraitorEndMessageSuccess>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful.</TraitorEndMessageSuccess>
<TraitorEndMessageSuccessTraitorDead>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor did not make it out alive either.</TraitorEndMessageSuccessTraitorDead>
<TraitorEndMessageSuccessTraitorDetained>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor was succesfully detained.</TraitorEndMessageSuccessTraitorDetained>
<TraitorEndMessageFailure>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was unsuccessful.</TraitorEndMessageFailure>
<TraitorEndMessageFailureTraitorDead>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname], but [genderpronoun] got [genderpronounreflexive] killed before completing it.</TraitorEndMessageFailureTraitorDead>
<TraitorEndMessageFailureTraitorDetained>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task failed - [genderpronoun] was successfully detained.</TraitorEndMessageFailureTraitorDetained>
<!-- Causes of death -->
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>

View File

@@ -178,7 +178,7 @@ namespace Barotrauma
}
}
endMessage += (TextManager.ReplaceGenderNouns(TextManager.Get(messageTag), traitorCharacter.Info.Gender) + "\n")
endMessage += (TextManager.ReplaceGenderPronouns(TextManager.Get(messageTag), traitorCharacter.Info.Gender) + "\n")
.Replace("[traitorname]", traitorCharacter.Name)
.Replace("[targetname]", targetCharacter.Name);
}

View File

@@ -57,26 +57,36 @@ namespace Barotrauma
return text;
}
public static string ReplaceGenderNouns(string text, Gender gender)
public static string ReplaceGenderPronouns(string text, Gender gender)
{
if (gender == Gender.Male)
{
return text.Replace("[gendernoun]", "he")
.Replace("[gendernounpossessive]", "his")
.Replace("[gendernounreflexive]", "himself")
.Replace("[Gendernoun]", "He")
.Replace("[Gendernounpossessive]", "His")
.Replace("[Gendernounreflexive]", "Himself");
return text.Replace("[genderpronoun]", Get("PronounMale").ToLower())
.Replace("[genderpronounpossessive]", Get("PronounPossessiveMale").ToLower())
.Replace("[genderpronounreflexive]", Get("PronounReflexiveMale").ToLower())
.Replace("[Genderpronoun]", Capitalize(Get("PronounMale")))
.Replace("[Genderpronounpossessive]", Capitalize(Get("PronounPossessiveMale")))
.Replace("[Genderpronounreflexive]", Capitalize(Get("PronounReflexiveMale")));
}
else
{
return text.Replace("[gendernoun]", "she")
.Replace("[gendernounpossessive]", "her")
.Replace("[gendernounreflexive]", "herself")
.Replace("[Gendernoun]", "She")
.Replace("[Gendernounpossessive]", "Her")
.Replace("[Gendernounreflexive]", "Herself");
return text.Replace("[genderpronoun]", Get("PronounFemale").ToLower())
.Replace("[genderpronounpossessive]", Get("PronounPossessiveFemale").ToLower())
.Replace("[genderpronounreflexive]", Get("PronounReflexiveFemale").ToLower())
.Replace("[Genderpronoun]", Capitalize(Get("PronounFemale")))
.Replace("[Genderpronounpossessive]", Capitalize(Get("PronounPossessiveFemale")))
.Replace("[Genderpronounreflexive]", Capitalize(Get("PronounReflexiveFemale")));
}
}
private static string Capitalize(string str)
{
if (string.IsNullOrWhiteSpace(str))
{
return str;
}
return char.ToUpper(str[0]) + str.Substring(1);
}
}
}