error while translating a mod, need a little help

Lazygamr77

Greenhorn
Hi there,

I was translating this mod called "(Tsundere) Wizard Marriage mod" from Chinese into English and am just about finished. Now, this is the first time I ever translated a mod before and therefore don't know a lot about the technical parts behind this. Anyways, while I was translating I must have mistyped something because, when I opened up stardew valley with the translated version of this mod, I got these errors:

[Event Repeater] Mod crashed on entry and might not work correctly. Technical details:
Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP]WizardMarriageMod\content.json. This doesn't seem to be valid JSON. Found curly quotes in the text; note that only straight quotes are allowed in JSON.
Technical details: After parsing a value an unexpected character was encountered: J. Path 'Changes[29].entries['112/n seenJunimoNote']', line 516, position 1467.

and

[Content Patcher] Error preloading content pack 'WizardMarriageMod'. Technical details:
Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP]WizardMarriageMod\content.json. This doesn't seem to be valid JSON. Found curly quotes in the text; note that only straight quotes are allowed in JSON.
Technical details: After parsing a value an unexpected character was encountered: J. Path 'Changes[29].entries['112/n seenJunimoNote']', line 516, position 1467.

I don't exactly know what this means, but I know that I want to fix it! I don't know a lot about things like this, so if anyone knows what these errors could mean and how I can fix them, that would be really helpful!


Thank you for reading.
Didnt mean to make it this long, sorry.
 
Last edited:
Hey, thanks for posting part of the log.

The key part is this section:
Code:
 Found curly quotes in the text; note that only straight quotes are allowed in JSON.
The curly quotes need to be switched over to straight quotes; as it basically confuses SMAPI.

Did you use Word when translating the mod? Human oriented editors like that can introduce bugs like this.
For modding; it's recommended to use a programmer's editor so that all text is formatted correctly for the computer to read.

I personally use Geany, which runs on Linux, Mac & Windows: https://www.geany.org/
But, there's also others.
For instance, the SDV wiki recommends the more popular, Sublime editor: https://www.sublimetext.com/

You can also use the SMAPI website's JSON validator to help you out: https://smapi.io/json
---------------
Example:
Here's a quick example with a manifest from my own mod. I intentionally broke the manifest by using curly quotes.

Broken code:
Code:
{
   "Name": "MysticTempest's Botany Machines",
   "Author": "MysticTempest",
   "Version": "1.0.4",
   "Description": "Adds machines for use with MysticTempest's Tea & Botany Mod.",
   "UniqueID": "MysticTempest.BotanyMachines",
   "ContentPackFor": {
      "UniqueID": "Platonymous.CustomFarming",
      "MinimumVersion": “2.9.10”
    }
}
It may be a little hard to see without zooming in; or using an editor. But, the quotes that are around 2.9.10 are actually curly. While all the other quotes in that code fragment are using straight quotes.
So, we fix it by replacing those curly quotes with simple straight quotes.
 

Lazygamr77

Greenhorn
Hey, thanks for posting part of the log.

The key part is this section:
Code:
 Found curly quotes in the text; note that only straight quotes are allowed in JSON.
The curly quotes need to be switched over to straight quotes; as it basically confuses SMAPI.

Did you use Word when translating the mod? Human oriented editors like that can introduce bugs like this.
For modding; it's recommended to use a programmer's editor so that all text is formatted correctly for the computer to read.

I personally use Geany, which runs on Linux, Mac & Windows: https://www.geany.org/
But, there's also others.
For instance, the SDV wiki recommends the more popular, Sublime editor: https://www.sublimetext.com/

You can also use the SMAPI website's JSON validator to help you out: https://smapi.io/json
---------------
Example:
Here's a quick example with a manifest from my own mod. I intentionally broke the manifest by using curly quotes.

Broken code:
Code:
{
   "Name": "MysticTempest's Botany Machines",
   "Author": "MysticTempest",
   "Version": "1.0.4",
   "Description": "Adds machines for use with MysticTempest's Tea & Botany Mod.",
   "UniqueID": "MysticTempest.BotanyMachines",
   "ContentPackFor": {
      "UniqueID": "Platonymous.CustomFarming",
      "MinimumVersion": “2.9.10”
    }
}
It may be a little hard to see without zooming in; or using an editor. But, the quotes that are around 2.9.10 are actually curly. While all the other quotes in that code fragment are using straight quotes.
So, we fix it by replacing those curly quotes with simple straight quotes.
Hey, thanks for posting part of the log.

The key part is this section:
Code:
 Found curly quotes in the text; note that only straight quotes are allowed in JSON.
The curly quotes need to be switched over to straight quotes; as it basically confuses SMAPI.

Did you use Word when translating the mod? Human oriented editors like that can introduce bugs like this.
For modding; it's recommended to use a programmer's editor so that all text is formatted correctly for the computer to read.

I personally use Geany, which runs on Linux, Mac & Windows: https://www.geany.org/
But, there's also others.
For instance, the SDV wiki recommends the more popular, Sublime editor: https://www.sublimetext.com/

You can also use the SMAPI website's JSON validator to help you out: https://smapi.io/json
---------------
Example:
Here's a quick example with a manifest from my own mod. I intentionally broke the manifest by using curly quotes.

Broken code:
Code:
{
   "Name": "MysticTempest's Botany Machines",
   "Author": "MysticTempest",
   "Version": "1.0.4",
   "Description": "Adds machines for use with MysticTempest's Tea & Botany Mod.",
   "UniqueID": "MysticTempest.BotanyMachines",
   "ContentPackFor": {
      "UniqueID": "Platonymous.CustomFarming",
      "MinimumVersion": “2.9.10”
    }
}
It may be a little hard to see without zooming in; or using an editor. But, the quotes that are around 2.9.10 are actually curly. While all the other quotes in that code fragment are using straight quotes.
So, we fix it by replacing those curly quotes with simple straight quotes.

Thank you so much for explaining the issue with the curly quotes and how to fix, it was basically eye-opening and fascinating for me to learn. Yes, I did use Word while translating, which is why I am so thankful for you recommending me to those programming editors, I will definitely use those in the future.
I followed your advice and the error that said "Found curly quotes in the text; note that only straight quotes are allowed in JSON." disappeared! What a relief!
But even though that error disappeared, different errors now show up in the log:

[Event Repeater] Mod crashed on entry and might not work correctly. Technical details:
Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP]WizardMarriageMod\content.json. This doesn't seem to be valid JSON.
Technical details: After parsing a value an unexpected character was encountered: A. Path 'Changes[28].Entries.wizardMeetKrobus', line 503, position 176.
at StardewModdingAPI.Toolkit.Serialization.JsonHelper.ReadJsonFileIfExists[TModel](String fullPath, TModel& result) in SMAPI.Toolkit\Serialization\JsonHelper.cs:line 74
at StardewModdingAPI.Framework.ContentPack.ReadJsonFile[TModel](String path) in SMAPI\Framework\ContentPack.cs:line 80
at EventRepeater.ModEntry.Entry(IModHelper helper) in E:\Stardew Vally Modding\EventRepeater\EventRepeater\ModEntry.cs:line 64
at StardewModdingAPI.Framework.SCore.LoadMods(IModMetadata[] mods, JsonHelper jsonHelper, ContentCoordinator contentCore, ModDatabase modDatabase) in SMAPI\Framework\SCore.cs:line 1529

and

[Content Patcher] Error preloading content pack 'WizardMarriageMod'. Technical details:
Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP]WizardMarriageMod\content.json. This doesn't seem to be valid JSON.
Technical details: After parsing a value an unexpected character was encountered: A. Path 'Changes[28].Entries.wizardMeetKrobus', line 503, position 176.
at StardewModdingAPI.Toolkit.Serialization.JsonHelper.ReadJsonFileIfExists[TModel](String fullPath, TModel& result) in E:\source\_Stardew\SMAPI\src\SMAPI.Toolkit\Serialization\JsonHelper.cs:line 74
at StardewModdingAPI.Framework.ContentPack.ReadJsonFile[TModel](String path) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentPack.cs:line 80
at ContentPatcher.Framework.RawContentPack.TryReloadContent(String& error) in E:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\RawContentPack.cs:line 78
at ContentPatcher.ModEntry.GetContentPacks()+MoveNext() in E:\source\_Stardew\Mods.Pathoschild\ContentPatcher\ModEntry.cs:line 369

and

[Content Patcher Animations] This mod failed in the GameLoop.UpdateTicked event. Technical details:
Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP]WizardMarriageMod\content.json. This doesn't seem to be valid JSON.
Technical details: After parsing a value an unexpected character was encountered: A. Path 'Changes[28].Entries.wizardMeetKrobus', line 503, position 176.
at StardewModdingAPI.Toolkit.Serialization.JsonHelper.ReadJsonFileIfExists[TModel](String fullPath, TModel& result) in SMAPI.Toolkit\Serialization\JsonHelper.cs:line 74
at StardewModdingAPI.Framework.ContentPack.ReadJsonFile[TModel](String path) in SMAPI\Framework\ContentPack.cs:line 80
at ContentPatcherAnimations.Mod.CollectPatches() in E:\source\_Stardew\Mods.spacechase0\ContentPatcherAnimations\Mod.cs:line 203
at ContentPatcherAnimations.Mod.OnUpdateTicked(Object sender, UpdateTickedEventArgs e) in E:\source\_Stardew\Mods.spacechase0\ContentPatcherAnimations\Mod.cs:line 114
at StardewModdingAPI.Framework.Events.ManagedEvent`1.Raise(TEventArgs args, Func`2 match) in SMAPI\Framework\Events\ManagedEvent.cs:line 126

I notice that all of them have a log that says: "Technical details: After parsing a value an unexpected character was encountered: A. Path 'Changes[28].Entries.wizardMeetKrobus', line 503, position 176."

Could this be a key part of this error or am I missing something?

Again, thank you so much for your help!
 
No prob! ^-^

So, this one's says there's a formatting error at Line 503, column 176.

I took a look at the original mod, and it seems the original used curly quotes in one of the dialogue sections. I'm a bit surprised; and I'm assuming this is the issue.

-----------------

Realistically, we want to do what they call 'escaping'. It's a way to put special characters into the text data. In our case, to use quotes within the dialogue, even though SMAPI is using quotes to enclose the whole discussion.

Now, we use backslashes to escape characters. It basically tells the computer that the very next character shouldn't be treated as special.
Since, it's being used to add internal quotes; in this case. The backslash needs to be placed before each internal quote.

I'm going to use the line from the original mod, & then the google translate example.
Original:
"wizardMeetKrobus": "我一直都帮忙法师先生找到他想要的书,但最近的书单都好奇怪喔!#$b#比如是“令人怦然心动的情话大全”…",


And, here is what the game sees when it's broken.

It thinks the first internal quote, which should've been escaped in the original mod; is the ending quote for the 'wizardMeetKrobus' data.
And, abruptly ends, and crashes.
Google Translate (Broken) as seen by SMAPI:
"wizardMeetKrobus": "I've always helped Mr. Mage find the books he wants, but the recent book list is so weird! #$b# For example, "A ,


Now, here's a fixed version where the internal quotes are properly escaped.
Google Translate (Fixed with escaped quotes):
"wizardMeetKrobus": "I've always helped Mr. Mage find the books he wants, but the recent book list is so weird! #$b# For example, \"A collection of heart-pounding love stories\"...",

---------------
Sorry, it's a bit verbose; but that should help. As I'm pretty sure that's the issue with the current error you posted.
Though if that wasn't it, and you're willing. Feel free to post or PM me your translated mod data, and I can help you pinpoint the bug more accurately.
 

Lazygamr77

Greenhorn
No prob! ^-^

So, this one's says there's a formatting error at Line 503, column 176.

I took a look at the original mod, and it seems the original used curly quotes in one of the dialogue sections. I'm a bit surprised; and I'm assuming this is the issue.

-----------------

Realistically, we want to do what they call 'escaping'. It's a way to put special characters into the text data. In our case, to use quotes within the dialogue, even though SMAPI is using quotes to enclose the whole discussion.

Now, we use backslashes to escape characters. It basically tells the computer that the very next character shouldn't be treated as special.
Since, it's being used to add internal quotes; in this case. The backslash needs to be placed before each internal quote.

I'm going to use the line from the original mod, & then the google translate example.
Original:
"wizardMeetKrobus": "我一直都帮忙法师先生找到他想要的书,但最近的书单都好奇怪喔!#$b#比如是“令人怦然心动的情话大全”…",


And, here is what the game sees when it's broken.

It thinks the first internal quote, which should've been escaped in the original mod; is the ending quote for the 'wizardMeetKrobus' data.
And, abruptly ends, and crashes.
Google Translate (Broken) as seen by SMAPI:
"wizardMeetKrobus": "I've always helped Mr. Mage find the books he wants, but the recent book list is so weird! #$b# For example, "A ,


Now, here's a fixed version where the internal quotes are properly escaped.
Google Translate (Fixed with escaped quotes):
"wizardMeetKrobus": "I've always helped Mr. Mage find the books he wants, but the recent book list is so weird! #$b# For example, \"A collection of heart-pounding love stories\"...",

---------------
Sorry, it's a bit verbose; but that should help. As I'm pretty sure that's the issue with the current error you posted.
Though if that wasn't it, and you're willing. Feel free to post or PM me your translated mod data, and I can help you pinpoint the bug more accurately.

Hi there,

I followed your advice again and I am happy to say that it worked!
The same issue seemed to be going on in different parts of the translation, but thanks to your help I was able to fix them.
Now I have no more errors showing up when I start stardew valley and I even got to see some of my translation work in-game.
Though as I was testing out the translation by playing one of the events (the one where you first meet the wizard). Everything seemed fine in the beginning, but after he gets the scroll and is about to read what it says, he stops, nothing happens. I checked the log and it kept repeating this error over and over again:

[SpaceCore] ERROR: Invalid command: message""We,

This error only appears as the event is playing
What could this mean?

The line of dialogue that seems to be the issue is this one:

/pause 1000/message\"\"We, the Junimos are willing to assist you. In return, we want to receive gifts from the valley. When you become one with the forest, then you will see the true meaning behind the scroll.\"/pause 500/

Did I do something wrong? Why is it an invalid command?
 
Hey @Lazygamr77 , glad to see you got it mostly all working!
And, thanks for posting the new log, & translation data you're working on.

This looks like an issue with you having an extra: \"
Right between 'message' and the start of the "We, the Junimos" text which you already escaped at the start, and the end.
 

Lazygamr77

Greenhorn
Hey @Lazygamr77 , glad to see you got it mostly all working!
And, thanks for posting the new log, & translation data you're working on.

This looks like an issue with you having an extra: \"
Right between 'message' and the start of the "We, the Junimos" text which you already escaped at the start, and the end.

Hello,

I got rid of the extra \" and now everything works perfectly!
Thank you SO much for your help! I never translated a mod before, so this is all very new to me, but I feel like I learned a lot!
 
Hello,

I got rid of the extra \" and now everything works perfectly!
Thank you SO much for your help! I never translated a mod before, so this is all very new to me, but I feel like I learned a lot!
No prob! I'm glad I could help you out; both with the errors, and helping you lean a bit! ^-^
 
Top