Translation in the works.

This commit is contained in:
2018-08-18 19:17:48 -07:00
parent ba64890e60
commit 8a0f669a28
5 changed files with 527 additions and 117 deletions

View File

@ -180,7 +180,14 @@ namespace Vocalization.Framework
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this); List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this);
foreach(var cleanSentence in clean) foreach(var cleanSentence in clean)
{ {
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions()); try
{
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch(Exception err)
{
}
} }
} }
@ -200,7 +207,15 @@ namespace Vocalization.Framework
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this); List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this);
foreach (var cleanSentence in clean) foreach (var cleanSentence in clean)
{ {
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions()); try
{
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch(Exception err)
{
}
} }
} }
@ -254,12 +269,8 @@ namespace Vocalization.Framework
} }
} }
} }
} }
} }
} }
else else
@ -278,5 +289,37 @@ namespace Vocalization.Framework
} }
/// <summary>
/// Change all of the files to the ones that are appropriate for that translation version.
/// </summary>
/// <param name="translation"></param>
public void initializeForTranslation(string translation)
{
for (int i = 0; i < this.dataFileNames.Count; i++)
{
string s = dataFileNames.ElementAt(i);
s=dataFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation));
dataFileNames[i] = s;
}
for (int i = 0; i < this.dialogueFileNames.Count; i++)
{
string s = dialogueFileNames.ElementAt(i);
s=dialogueFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation));
dialogueFileNames[i] = s;
}
for (int i = 0; i < this.stringsFileNames.Count; i++)
{
string s = stringsFileNames.ElementAt(i);
s=stringsFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation));
stringsFileNames[i] = s;
}
}
} }
} }

View File

@ -0,0 +1,358 @@
using StardewValley;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vocalization.Framework
{
/// <summary>
/// A class which deals with handling different translations for Vocalization should other voice teams ever wish to voice act for that language.
/// </summary>
public class TranslationInfo
{
/// <summary>
/// The list of all supported translations by this mod.
/// </summary>
public List<string> translations;
/// <summary>
/// The current translation mode for the mod, so that it knows what files to load at the beginning of the game.
/// </summary>
public string currentTranslation;
/// <summary>
/// Holds the info for what translation has what file extension.
/// </summary>
public Dictionary<string, string> translationFileInfo;
/// <summary>
/// Default constructor.
/// </summary>
public TranslationInfo()
{
translations = new List<string>();
translationFileInfo = new Dictionary<string, string>();
translations.Add("English");
translations.Add("Spanish");
translations.Add("Chinese");
translations.Add("Japanese");
translations.Add("Russian");
translations.Add("German");
translations.Add("Brazillian Portuguese");
currentTranslation = "English";
translationFileInfo.Add("English", ".xnb");
translationFileInfo.Add("Spanish", ".es - ES.xnb");
translationFileInfo.Add("Chinese", ".zh-CN.xnb");
translationFileInfo.Add("Japanese", ".ja-JP.xnb");
translationFileInfo.Add("Russian", ".ru-RU.xnb");
translationFileInfo.Add("German", ".de-DE.xnb");
translationFileInfo.Add("Brazillian Portuguese", ".pt-BR.xnb");
}
/// <summary>
/// Gets the proper file extension for the current translation.
/// </summary>
/// <param name="translation"></param>
/// <returns></returns>
public string getFileExtentionForTranslation(string translation)
{
bool f = translationFileInfo.TryGetValue(translation, out string value);
if (f == false) return ".xnb";
else return value;
}
/// <summary>
/// Gets the proper XNB for Buildings (aka Blueprints) from the data folder.
/// </summary>
/// <param name="translation"></param>
/// <returns></returns>
public string getBuildingXNBForTranslation(string translation)
{
string buildings = "Blueprints";
return buildings + getFileExtentionForTranslation(translation);
}
/// <summary>
/// Gets the proper XNB file for the name passed in. Combines the file name with it's proper translation extension.
/// </summary>
/// <param name="xnbFileName"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string getXNBForTranslation(string xnbFileName, string translation)
{
return xnbFileName + translation;
}
/// <summary>
/// Loads a coresponding string from a data file in Content/Strings
/// </summary>
/// <param name="xnbFileName"></param>
/// <param name="key"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string LoadStringFromStringsFile(string xnbFileName,string key,string translation)
{
string str = "Strings";
string xnb = xnbFileName + getFileExtentionForTranslation(translation);
string path = Path.Combine(str, xnbFileName);
Dictionary<string,string> loadedDict = Game1.content.Load<Dictionary<string, string>>(path);
return loadedDict[key];
}
public string LoadStringFromStringsFile(string xnbFileName, string key, string translation, object sub1)
{
string loaded = LoadStringFromStringsFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromStringsFile(string xnbFileName, string key, string translation, object sub1, object sub2)
{
string loaded = LoadStringFromStringsFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1,sub2);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromStringsFile(string xnbFileName, string key, string translation, object sub1, object sub2, object sub3)
{
string loaded = LoadStringFromStringsFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1, sub2,sub3);
}
catch (Exception err)
{
return loaded;
}
}
/// <summary>
/// Loads a corresponding string from a data file in Content/Data
/// </summary>
/// <param name="xnbFileName"></param>
/// <param name="key"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string LoadStringFromDataFile(string xnbFileName, string key, string translation)
{
string str = "Data";
string xnb = xnbFileName + getFileExtentionForTranslation(translation);
string path = Path.Combine(str, xnbFileName);
Dictionary<string, string> loadedDict = Game1.content.Load<Dictionary<string, string>>(path);
string loaded = loadedDict[key];
return loaded;
}
public string LoadStringFromDataFile(string xnbFileName, string key, string translation, object sub1)
{
string loaded = LoadStringFromDataFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromDataFile(string xnbFileName, string key, string translation, object sub1, object sub2)
{
string loaded = LoadStringFromDataFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1,sub2);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromDataFile(string xnbFileName, string key, string translation, object sub1, object sub2, object sub3)
{
string loaded = LoadStringFromDataFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1,sub2,sub3);
}
catch (Exception err)
{
return loaded;
}
}
public virtual string LoadString(string path, string translation,object sub1, object sub2, object sub3)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[]{ Environment.NewLine },StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
{
if (sub3 != null) {
return LoadStringFromDataFile(assetName, key, translation, sub1, sub2, sub3);
}
if (sub2 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1);
}
return LoadStringFromDataFile(assetName, key, translation);
}
if (folder == "Strings")
{
if (sub3 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1, sub2, sub3);
}
if (sub2 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1);
}
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
}
public virtual string LoadString(string path, string translation, object sub1, object sub2)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
{
if (sub2 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1);
}
return LoadStringFromDataFile(assetName, key, translation);
}
if (folder == "Strings")
{
if (sub2 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1);
}
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
}
public virtual string LoadString(string path, string translation, object sub1)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
{
if (sub1 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1);
}
return LoadStringFromDataFile(assetName, key, translation);
}
if (folder == "Strings")
{
if (sub1 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1);
}
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
}
public virtual string LoadString(string path, string translation)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
{
return LoadStringFromDataFile(assetName, key, translation);
}
if (folder == "Strings") {
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
}
public virtual string LoadString(string path,string translation, params object[] substitutions)
{
string format = this.LoadString(path,translation);
if (substitutions.Length != 0)
{
try
{
return string.Format(format, substitutions);
}
catch (Exception ex)
{
}
}
return format;
}
private void parseStringPath(string path, out string assetName, out string key)
{
int length = path.IndexOf(':');
assetName = path.Substring(0, length);
key = path.Substring(length + 1, path.Length - length - 1);
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Vocalization.Framework;
namespace Vocalization namespace Vocalization
{ {
@ -11,14 +12,11 @@ namespace Vocalization
/// </summary> /// </summary>
public class ModConfig public class ModConfig
{ {
/// <summary> /// <summary>
/// A list of all of the translations currently supported by this mod. /// Handles all of the translation information and parsing.
/// </summary> /// </summary>
public List<string> translations; public TranslationInfo translationInfo;
/// <summary>
/// The currently selected translation to use.
/// </summary>
public string currentTranslation;
/// <summary> /// <summary>
/// Keeps track of the voice modes for determining how much audio is played. /// Keeps track of the voice modes for determining how much audio is played.
@ -37,7 +35,6 @@ namespace Vocalization
public ModConfig() public ModConfig()
{ {
translations = new List<string>();
modes = new List<string>(); modes = new List<string>();
modes.Add("Simple"); modes.Add("Simple");
@ -46,9 +43,8 @@ namespace Vocalization
modes.Add("SimpleAndHeartEvents"); modes.Add("SimpleAndHeartEvents");
currentMode = "Full"; currentMode = "Full";
translationInfo = new TranslationInfo();
translations.Add("English");
currentTranslation = "English";
this.voiceVolume = 1.0f; this.voiceVolume = 1.0f;
} }
@ -66,5 +62,7 @@ namespace Vocalization
} }
} }
} }

View File

@ -511,7 +511,7 @@ namespace Vocalization
{ {
foreach(var NPC in loc.characters) foreach(var NPC in loc.characters)
{ {
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string characterPath = Path.Combine(translation, NPC.Name); string characterPath = Path.Combine(translation, NPC.Name);
characterDialoguePaths.Add(characterPath); characterDialoguePaths.Add(characterPath);
@ -520,82 +520,82 @@ namespace Vocalization
} }
//Create all of the necessary folders for different translations. //Create all of the necessary folders for different translations.
foreach (var dir in config.translations) foreach (var dir in config.translationInfo.translations)
{ {
if (!Directory.Exists(Path.Combine(voicePath,dir))) Directory.CreateDirectory(Path.Combine(voicePath, dir)); if (!Directory.Exists(Path.Combine(voicePath,dir))) Directory.CreateDirectory(Path.Combine(voicePath, dir));
} }
//Add in folder for TV Shows //Add in folder for TV Shows
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string TVPath = Path.Combine(translation, "TV"); string TVPath = Path.Combine(translation, "TV");
characterDialoguePaths.Add(TVPath); characterDialoguePaths.Add(TVPath);
} }
//Add in folder for shop support //Add in folder for shop support
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string shop = Path.Combine(translation, "Shops"); //Used to hold NPC Shops string shop = Path.Combine(translation, "Shops"); //Used to hold NPC Shops
characterDialoguePaths.Add(shop); characterDialoguePaths.Add(shop);
} }
//Add in folder for Mail support. //Add in folder for Mail support.
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string mail = Path.Combine(translation, "Mail"); string mail = Path.Combine(translation, "Mail");
characterDialoguePaths.Add(mail); characterDialoguePaths.Add(mail);
} }
//Add in folder for ExtraDiaogue.yaml //Add in folder for ExtraDiaogue.yaml
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "ExtraDialogue"); string extra = Path.Combine(translation, "ExtraDialogue");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "Events"); string extra = Path.Combine(translation, "Events");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "Characters"); string extra = Path.Combine(translation, "Characters");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "LocationDialogue"); string extra = Path.Combine(translation, "LocationDialogue");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "Notes"); string extra = Path.Combine(translation, "Notes");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "Utility"); string extra = Path.Combine(translation, "Utility");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "NPCGiftTastes"); string extra = Path.Combine(translation, "NPCGiftTastes");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "SpeechBubbles"); string extra = Path.Combine(translation, "SpeechBubbles");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string kent = Path.Combine(translation, "Kent"); string kent = Path.Combine(translation, "Kent");
characterDialoguePaths.Add(kent); characterDialoguePaths.Add(kent);
@ -619,14 +619,14 @@ namespace Vocalization
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "Quests"); string extra = Path.Combine(translation, "Quests");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
} }
foreach (var translation in config.translations) foreach (var translation in config.translationInfo.translations)
{ {
string extra = Path.Combine(translation, "Temp"); string extra = Path.Combine(translation, "Temp");
characterDialoguePaths.Add(extra); characterDialoguePaths.Add(extra);
@ -637,6 +637,7 @@ namespace Vocalization
if (!Directory.Exists(voicePath)) Directory.CreateDirectory(voicePath); if (!Directory.Exists(voicePath)) Directory.CreateDirectory(voicePath);
//Create a list of new directories if the corresponding character directory doesn't exist. //Create a list of new directories if the corresponding character directory doesn't exist.
//Note: A modder could also manually add in their own character directory for voice lines instead of having to add it via code. //Note: A modder could also manually add in their own character directory for voice lines instead of having to add it via code.
foreach (var dir in characterDialoguePaths) foreach (var dir in characterDialoguePaths)
@ -680,15 +681,16 @@ namespace Vocalization
{ {
CharacterVoiceCue cue = new CharacterVoiceCue(characterName); CharacterVoiceCue cue = new CharacterVoiceCue(characterName);
//Change this up for different translations??? //Change this up for different translations???
if (translation == "English") cue.initializeEnglishScrape();
{ cue.initializeForTranslation(translation);
cue.initializeEnglishScrape(); scrapeDictionaries(voiceCueFile,cue,translation);
}
scrapeDictionaries(voiceCueFile,cue);
///??? DO I NEVER ACTUALLY ADD IT IN??? ///??? DO I NEVER ACTUALLY ADD IT IN???
try try
{ {
DialogueCues.Add(characterName, cue); if (translation == config.translationInfo.currentTranslation)
{
DialogueCues.Add(characterName, cue);
}
} }
catch(Exception err) catch(Exception err)
{ {
@ -701,7 +703,10 @@ namespace Vocalization
//scrapeDictionaries(voiceCueFile,cue); //scrapeDictionaries(voiceCueFile,cue);
try try
{ {
DialogueCues.Add(characterName, cue); if (translation == config.translationInfo.currentTranslation)
{
DialogueCues.Add(characterName, cue);
}
} }
catch (Exception err) catch (Exception err)
{ {
@ -717,7 +722,7 @@ namespace Vocalization
/// Used to obtain all strings for almost all possible dialogue in the game. /// Used to obtain all strings for almost all possible dialogue in the game.
/// </summary> /// </summary>
/// <param name="cue"></param> /// <param name="cue"></param>
public void scrapeDictionaries(string path,CharacterVoiceCue cue) public void scrapeDictionaries(string path,CharacterVoiceCue cue,string translation)
{ {
var dialoguePath = Path.Combine("Characters", "Dialogue"); var dialoguePath = Path.Combine("Characters", "Dialogue");
@ -909,24 +914,24 @@ namespace Vocalization
{ {
if(key== "NewChild_Adoption") { if(key== "NewChild_Adoption") {
cue.addDialogue(Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:"+key),replacementStrings.kid1Name), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue",key,translation,replacementStrings.kid1Name), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:" + key), replacementStrings.kid2Name), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue", key, translation, replacementStrings.kid2Name), new VoiceAudioOptions());
continue; continue;
} }
if(key== "NewChild_FirstChild") if(key== "NewChild_FirstChild")
{ {
cue.addDialogue(Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:" + key), replacementStrings.kid1Name), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue", key, translation, replacementStrings.kid1Name), new VoiceAudioOptions());
continue; continue;
} }
if(key== "Farm_RobinWorking_ReadyTomorrow" || key== "Robin_NewConstruction_Festival"||key== "Robin_NewConstruction" || key== "Robin_Instant") if(key== "Farm_RobinWorking_ReadyTomorrow" || key== "Robin_NewConstruction_Festival"||key== "Robin_NewConstruction" || key== "Robin_Instant")
{ {
string buildingsPath = Path.Combine(dataPath, "Blueprints.xnb"); string buildingsPath = Path.Combine(dataPath, config.translationInfo.getBuildingXNBForTranslation(translation));
var BuildingDict = ModHelper.Content.Load<Dictionary<string, string>>(buildingsPath, ContentSource.GameContent); var BuildingDict = ModHelper.Content.Load<Dictionary<string, string>>(buildingsPath, ContentSource.GameContent);
foreach(KeyValuePair<string, string> pair2 in BuildingDict) foreach(KeyValuePair<string, string> pair2 in BuildingDict)
{ {
List<string> cleanedDialogues = sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:" + key), pair2.Key),cue); List<string> cleanedDialogues = sanitizeDialogueFromDictionaries(config.translationInfo.LoadStringFromDataFile("ExtraDialogue",key,translation,pair2.Key),cue);
foreach (var clean_str in cleanedDialogues) { foreach (var clean_str in cleanedDialogues) {
cue.addDialogue(clean_str, new VoiceAudioOptions()); cue.addDialogue(clean_str, new VoiceAudioOptions());
} }
@ -936,14 +941,14 @@ namespace Vocalization
if (key == "Farm_RobinWorking1" || key== "Farm_RobinWorking2") if (key == "Farm_RobinWorking1" || key== "Farm_RobinWorking2")
{ {
string buildingsPath = Path.Combine(dataPath, "Blueprints.xnb"); string buildingsPath = Path.Combine(dataPath, config.translationInfo.getBuildingXNBForTranslation(translation));
var BuildingDict = ModHelper.Content.Load<Dictionary<string, string>>(buildingsPath, ContentSource.GameContent); var BuildingDict = ModHelper.Content.Load<Dictionary<string, string>>(buildingsPath, ContentSource.GameContent);
foreach (KeyValuePair<string, string> pair2 in BuildingDict) foreach (KeyValuePair<string, string> pair2 in BuildingDict)
{ {
for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
{ {
cue.addDialogue(Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:" + key), pair2.Key,i.ToString()), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:" + key), pair2.Key,i.ToString()), new VoiceAudioOptions());
} }
} }
continue; continue;
@ -968,7 +973,7 @@ namespace Vocalization
{ {
foreach(var lvl in levels) foreach(var lvl in levels)
{ {
cue.addDialogue(Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:" + key), lvl+tool), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue", key,translation ,lvl+tool), new VoiceAudioOptions());
} }
} }
continue; continue;
@ -1413,29 +1418,32 @@ namespace Vocalization
string contentPath = Path.Combine(basePath, "Content"); string contentPath = Path.Combine(basePath, "Content");
string audioPath = Path.Combine(contentPath, "Audio"); string audioPath = Path.Combine(contentPath, "Audio");
string voicePath = Path.Combine(audioPath, "VoiceFiles"); string voicePath = Path.Combine(audioPath, "VoiceFiles");
string[] dirs = Directory.GetDirectories(Path.Combine(voicePath,"English"));
//Some additional scraping to put together better options for speech bubbles.
foreach (var v in dirs)
{
string name = Path.GetFileName(v);
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4068"), (object)name), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4065")) + ", " + Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4066"), (object)name), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4071"), (object)name), new VoiceAudioOptions());
}
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4060")), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4072")), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4063")), new VoiceAudioOptions()); string[] dirs = Directory.GetDirectories(Path.Combine(voicePath, translation));
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4064")), new VoiceAudioOptions()); //Some additional scraping to put together better options for speech bubbles.
foreach (var v in dirs)
{
string name = Path.GetFileName(v);
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4068"), translation, (object)name), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4065"),translation) + ", " + config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4066"), translation, (object)name), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4071"), translation, (object)name), new VoiceAudioOptions());
}
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4060"),translation), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4072"),translation), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4063"),translation), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4064"),translation), new VoiceAudioOptions());
//cue.addDialogue("Hey, it's farmer, " + replacementStrings.farmerName,new VoiceAudioOptions()); //cue.addDialogue("Hey, it's farmer, " + replacementStrings.farmerName,new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4062")), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4062"),translation), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4061")), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4061"),translation), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4060")), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4060"),translation), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4059")), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4059"),translation), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4058")), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4058"),translation), new VoiceAudioOptions());
} }
@ -1649,44 +1657,46 @@ namespace Vocalization
} }
} }
//Scrape dialogue more specifically and replace some generic {0}'s and {1}'s //Scrape dialogue more specifically and replace some generic {0}'s and {1}'s
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3955"), (object)cue.name), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3955"), translation, (object)cue.name), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3969"), (object)cue.name), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3969"), translation, (object)cue.name), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3981"), (object)cue.name), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3981"), translation, (object)cue.name), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3987"), (object)cue.name,"2"),new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.3987"), translation, (object)cue.name,"2"),new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4066"), (object)replacementStrings.farmerName), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4066"), translation, (object)replacementStrings.farmerName), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4068"), (object)replacementStrings.farmerName), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4068"), translation, (object)replacementStrings.farmerName), new VoiceAudioOptions());
cue.addDialogue(Game1.content.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4071"), (object)replacementStrings.farmerName), new VoiceAudioOptions()); cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4071"), translation, (object)replacementStrings.farmerName), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4440"), (object)replacementStrings.farmerName),cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4440"), translation, (object)replacementStrings.farmerName),cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4441"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4441"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4444"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4444"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4445"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4445"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4447"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4447"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4448"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4448"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4463"), (object)replacementStrings.petName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4463"), translation, (object)replacementStrings.petName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4465"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4465"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4466"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4466"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4486"), (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4486"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
for (int i = 4507; i <= 4523; i++) for (int i = 4507; i <= 4523; i++)
{ {
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4465"), (object)Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.")+i.ToString())), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4465"), translation, (object)config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.")+i.ToString(),translation)), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4466"), (object)Game1.content.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.") + i.ToString())), cue).ElementAt(0), new VoiceAudioOptions()); cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4466"), translation, (object)config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.") + i.ToString(),translation)), cue).ElementAt(0), new VoiceAudioOptions());
} }
//DO PARSE LOGIC HERE //DO PARSE LOGIC HERE
//cue.addDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3985", (object)cue.name), new VoiceAudioOptions()); //cue.addDialogue(config.translationInfo.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3985", (object)cue.name), new VoiceAudioOptions());
string basePath = ModHelper.DirectoryPath; string basePath = ModHelper.DirectoryPath;
string contentPath = Path.Combine(basePath, "Content"); string contentPath = Path.Combine(basePath, "Content");
string audioPath = Path.Combine(contentPath, "Audio"); string audioPath = Path.Combine(contentPath, "Audio");
string voicePath = Path.Combine(audioPath, "VoiceFiles"); string voicePath = Path.Combine(audioPath, "VoiceFiles");
string[] dirs = Directory.GetDirectories(Path.Combine(voicePath, "English"));
//Some additional scraping to put together better options for speech bubbles. string[] dirs = Directory.GetDirectories(Path.Combine(voicePath, translation));
foreach (var v in dirs) //Some additional scraping to put together better options for speech bubbles.
{ foreach (var v in dirs)
string name = Path.GetFileName(v); {
cue.addDialogue(sanitizeDialogueFromDictionaries(Game1.content.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.3985"), (object)name), cue).ElementAt(0), new VoiceAudioOptions()); string name = Path.GetFileName(v);
} cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.3985"), translation, (object)name), cue).ElementAt(0), new VoiceAudioOptions());
}
continue; continue;
} }
@ -1727,13 +1737,13 @@ namespace Vocalization
for(int i=0; i<=3; i++) { for(int i=0; i<=3; i++) {
StardewValley.Object obj = new StardewValley.Object(pair.Key,1,false,-1,i); StardewValley.Object obj = new StardewValley.Object(pair.Key,1,false,-1,i);
string[] strArray = Game1.content.LoadString(Path.Combine("Strings","Lexicon:GenericPlayerTerm")).Split('^'); string[] strArray = config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:GenericPlayerTerm"),translation).Split('^');
string str2 = strArray[0]; string str2 = strArray[0];
if (strArray.Length > 1 && !(bool)((NetFieldBase<bool, NetBool>)Game1.player.isMale)) if (strArray.Length > 1 && !(bool)((NetFieldBase<bool, NetBool>)Game1.player.isMale))
str2 = strArray[1]; str2 = strArray[1];
string str3 = Game1.player.Name; string str3 = Game1.player.Name;
List<string> rawScrape = getPurchasedItemDialogueForNPC(obj, cue.name,str3); List<string> rawScrape = getPurchasedItemDialogueForNPC(obj, cue.name,str3,translation);
foreach (string raw in rawScrape) foreach (string raw in rawScrape)
{ {
@ -1746,7 +1756,7 @@ namespace Vocalization
} }
str3 = str2; str3 = str2;
List<string> rawScrape2 = getPurchasedItemDialogueForNPC(obj, cue.name, str3); List<string> rawScrape2 = getPurchasedItemDialogueForNPC(obj, cue.name, str3,translation);
foreach (string raw in rawScrape2) foreach (string raw in rawScrape2)
{ {
List<string> cleanDialogues2 = sanitizeDialogueFromDictionaries(raw, cue); List<string> cleanDialogues2 = sanitizeDialogueFromDictionaries(raw, cue);
@ -1760,7 +1770,7 @@ namespace Vocalization
} }
ModHelper.WriteJsonFile<CharacterVoiceCue>(path,cue); ModHelper.WriteJsonFile<CharacterVoiceCue>(path,cue);
DialogueCues.Add(cue.name, cue); //DialogueCues.Add(cue.name, cue);
} }
@ -1770,7 +1780,7 @@ namespace Vocalization
/// <param name="i"></param> /// <param name="i"></param>
/// <param name="npcName"></param> /// <param name="npcName"></param>
/// <returns></returns> /// <returns></returns>
public List<string> getPurchasedItemDialogueForNPC(StardewValley.Object i, string npcName, string str3) public List<string> getPurchasedItemDialogueForNPC(StardewValley.Object i, string npcName, string str3,string translation)
{ {
NPC n = Game1.getCharacterFromName(npcName); NPC n = Game1.getCharacterFromName(npcName);
if (n == null) return new List<string>(); if (n == null) return new List<string>();
@ -1780,7 +1790,7 @@ namespace Vocalization
str3 = Game1.player.Name; str3 = Game1.player.Name;
string str4 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en ? Lexicon.getProperArticleForWord(i.name) : ""; string str4 = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en ? Lexicon.getProperArticleForWord(i.name) : "";
if ((i.Category == -4 || i.Category == -75 || i.Category == -79) && Game1.random.NextDouble() < 0.5) if ((i.Category == -4 || i.Category == -75 || i.Category == -79) && Game1.random.NextDouble() < 0.5)
str4 = Game1.content.LoadString(Path.Combine("Strings", "StringsFromCSFiles:SeedShop.cs.9701")); str4 = config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:SeedShop.cs.9701"),translation);
for (int v = 0; v <= 5; v++) for (int v = 0; v <= 5; v++)
{ {
@ -1793,7 +1803,7 @@ namespace Vocalization
{ {
foreach (string str in Vocabulary.getRandomDeliciousAdjectives(n)) foreach (string str in Vocabulary.getRandomDeliciousAdjectives(n))
{ {
string str19 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_1_QualityHigh"), (object)str3, (object)str4, (object)i.DisplayName, (object)str); string str19 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_1_QualityHigh"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)str);
dialogueReturn.Add(str19); dialogueReturn.Add(str19);
} }
//break; //break;
@ -1802,13 +1812,13 @@ namespace Vocalization
{ {
foreach (string str in Vocabulary.getRandomNegativeFoodAdjectives(n)) foreach (string str in Vocabulary.getRandomNegativeFoodAdjectives(n))
{ {
string str18 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_1_QualityLow"), (object)str3, (object)str4, (object)i.DisplayName, (object)str); string str18 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_1_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)str);
dialogueReturn.Add(str18); dialogueReturn.Add(str18);
} }
} }
break; break;
case 1: case 1:
string str2 = (i.quality.Value) != 0 ? (!n.Name.Equals("Jodi") ? Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_2_QualityHigh"), (object)str3, (object)str4, (object)i.DisplayName) : Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_2_QualityHigh_Jodi"), (object)str3, (object)str4, (object)i.DisplayName)) : Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_2_QualityLow"), (object)str3, (object)str4, (object)i.DisplayName); string str2 = (i.quality.Value) != 0 ? (!n.Name.Equals("Jodi") ? config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_2_QualityHigh"), translation, (object)str3, (object)str4, (object)i.DisplayName) : config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_2_QualityHigh_Jodi"), translation, (object)str3, (object)str4, (object)i.DisplayName)) : config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_2_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName);
dialogueReturn.Add(str2); dialogueReturn.Add(str2);
break; break;
case 2: case 2:
@ -1819,7 +1829,7 @@ namespace Vocalization
foreach (var word1 in Vocabulary.getRandomNegativeFoodAdjectives(n)) foreach (var word1 in Vocabulary.getRandomNegativeFoodAdjectives(n))
{ {
foreach (string word2 in Vocabulary.getRandomNegativeItemSlanderNouns()) { foreach (string word2 in Vocabulary.getRandomNegativeItemSlanderNouns()) {
string str17 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_QualityLow_Rude"), (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2), (object)word1, (object)word2); string str17 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_QualityLow_Rude"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2), (object)word1, (object)word2);
dialogueReturn.Add(str17); dialogueReturn.Add(str17);
} }
} }
@ -1827,22 +1837,22 @@ namespace Vocalization
} }
foreach (string word1 in Vocabulary.getRandomSlightlyPositiveAdjectivesForEdibleNoun(n)) foreach (string word1 in Vocabulary.getRandomSlightlyPositiveAdjectivesForEdibleNoun(n))
{ {
string str10 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_QualityHigh_Rude"), (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2), (object)word1); string str10 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_QualityHigh_Rude"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2), (object)word1);
dialogueReturn.Add(str10); dialogueReturn.Add(str10);
} }
break; break;
} }
string str11 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_NonRude"), (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2)); string str11 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_NonRude"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2));
dialogueReturn.Add(str11); dialogueReturn.Add(str11);
break; break;
case 3: case 3:
string str12 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_4"), (object)str3, (object)str4, (object)i.DisplayName); string str12 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_4"), translation, (object)str3, (object)str4, (object)i.DisplayName);
dialogueReturn.Add(str12); dialogueReturn.Add(str12);
break; break;
case 4: case 4:
if (i.Category == -75 || i.Category == -79) if (i.Category == -75 || i.Category == -79)
{ {
string str13 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_VegetableOrFruit"), (object)str3, (object)str4, (object)i.DisplayName); string str13 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_VegetableOrFruit"), translation, (object)str3, (object)str4, (object)i.DisplayName);
dialogueReturn.Add(str13); dialogueReturn.Add(str13);
break; break;
} }
@ -1850,18 +1860,18 @@ namespace Vocalization
{ {
foreach (string forEventOrPerson in Vocabulary.getRandomPositiveAdjectivesForEventOrPerson(n)) foreach (string forEventOrPerson in Vocabulary.getRandomPositiveAdjectivesForEventOrPerson(n))
{ {
string str14 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_Cooking"), (object)str3, (object)str4, (object)i.DisplayName, (object)Lexicon.getProperArticleForWord(forEventOrPerson), (object)forEventOrPerson); string str14 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_Cooking"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)Lexicon.getProperArticleForWord(forEventOrPerson), (object)forEventOrPerson);
dialogueReturn.Add(str14); dialogueReturn.Add(str14);
} }
break; break;
} }
string str15 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_Foraged"), (object)str3, (object)str4, (object)i.DisplayName); string str15 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_Foraged"), translation, (object)str3, (object)str4, (object)i.DisplayName);
dialogueReturn.Add(str15); dialogueReturn.Add(str15);
break; break;
} }
} }
if (n.Age == 1) { if (n.Age == 1) {
string str16 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Teen"), (object)str3, (object)str4, (object)i.DisplayName); string str16 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Teen"), translation, (object)str3, (object)str4, (object)i.DisplayName);
dialogueReturn.Add(str16); dialogueReturn.Add(str16);
} }
@ -1869,15 +1879,15 @@ namespace Vocalization
string str1 = ""; string str1 = "";
if (name == "Alex") if (name == "Alex")
{ {
str1 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Alex"), (object)str3, (object)str4, (object)i.DisplayName); str1 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Alex"), translation, (object)str3, (object)str4, (object)i.DisplayName);
} }
if (name == "Caroline") if (name == "Caroline")
{ {
str1 = (int)((NetFieldBase<int, NetInt>)i.quality) != 0 ? Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Caroline_QualityHigh"), (object)str3, (object)str4, (object)i.DisplayName) : Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Caroline_QualityLow"), (object)str3, (object)str4, (object)i.DisplayName); str1 = (int)((NetFieldBase<int, NetInt>)i.quality) != 0 ? config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Caroline_QualityHigh"), translation, (object)str3, (object)str4, (object)i.DisplayName) : config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Caroline_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName);
} }
if (name == "Pierre") if (name == "Pierre")
{ {
str1 = (int)((NetFieldBase<int, NetInt>)i.quality) != 0 ? Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Pierre_QualityHigh"), (object)str3, (object)str4, (object)i.DisplayName) : Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Pierre_QualityLow"), (object)str3, (object)str4, (object)i.DisplayName); str1 = (int)((NetFieldBase<int, NetInt>)i.quality) != 0 ? config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Pierre_QualityHigh"), translation, (object)str3, (object)str4, (object)i.DisplayName) : config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Pierre_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName);
} }
@ -1887,23 +1897,23 @@ namespace Vocalization
{ {
foreach (string word1 in Vocabulary.getRandomNegativeItemSlanderNouns()) foreach (string word1 in Vocabulary.getRandomNegativeItemSlanderNouns())
{ {
string str12 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Abigail_QualityLow"), (object)str3, (object)str4, (object)i.DisplayName, (object)word1); string str12 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Abigail_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)word1);
dialogueReturn.Add(str12); dialogueReturn.Add(str12);
} }
} }
else { else {
str1 = Game1.content.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Abigail_QualityHigh"), (object)str3, (object)str4, (object)i.DisplayName); str1 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Abigail_QualityHigh"), translation, (object)str3, (object)str4, (object)i.DisplayName);
} }
} }
if (name == "Haley") if (name == "Haley")
str1 = Game1.content.LoadString(Path.Combine("Data","ExtraDialogue:PurchasedItem_Haley"), (object)str3, (object)str4, (object)i.DisplayName); str1 = config.translationInfo.LoadString(Path.Combine("Data","ExtraDialogue:PurchasedItem_Haley"), translation, (object)str3, (object)str4, (object)i.DisplayName);
if (name == "Elliott") if (name == "Elliott")
str1 = Game1.content.LoadString(Path.Combine("Data","ExtraDialogue:PurchasedItem_Elliott"), (object)str3, (object)str4, (object)i.DisplayName); str1 = config.translationInfo.LoadString(Path.Combine("Data","ExtraDialogue:PurchasedItem_Elliott"), translation, (object)str3, (object)str4, (object)i.DisplayName);
if (name == "Leah") if (name == "Leah")
str1 = Game1.content.LoadString(Path.Combine("Data","ExtraDialogue:PurchasedItem_Leah"), (object)str3, (object)str4, (object)i.DisplayName); str1 = config.translationInfo.LoadString(Path.Combine("Data","ExtraDialogue:PurchasedItem_Leah"), translation, (object)str3, (object)str4, (object)i.DisplayName);
if (str1 != "") if (str1 != "")
{ {
dialogueReturn.Add(str1); dialogueReturn.Add(str1);

View File

@ -50,6 +50,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Framework\CharacterVoiceCue.cs" /> <Compile Include="Framework\CharacterVoiceCue.cs" />
<Compile Include="Framework\ReplacementStrings.cs" /> <Compile Include="Framework\ReplacementStrings.cs" />
<Compile Include="Framework\TranslationInfo.cs" />
<Compile Include="Framework\Vocabulary.cs" /> <Compile Include="Framework\Vocabulary.cs" />
<Compile Include="Framework\VoiceAudioOptions.cs" /> <Compile Include="Framework\VoiceAudioOptions.cs" />
<Compile Include="ModConfig.cs" /> <Compile Include="ModConfig.cs" />