Move hard-coded gender pronouns from TextManager to Texts.xml
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user