Hello guys, I am localizing my game and I incurred in a serious issue which is impacting my productivity. I import csv files for localization using the Localization built-in csv importer.
The issue is I cannot import localized text containing commas (e.g. I have to avoid using “Hello, I’m the player” in a cell because it would be splitted).
The problem is, for my Mac OS system, the list separator is a semicolon. Which is perfect for my use case, as I just export my csv and they will use semicolon as separator, allowing me to use commas in text.
But when I try to import into Unity, they won’t be read and an error is thrown.
Digging a bit deeper, I discovered that no matter my OS Language and Culture settings, Unity will always print “EN-US” when I query for CurrentCulture (thus querying System.Globalization.CurrentCulture.Info.ListSeparator returns a “,”).
For test purposes, I’m using “|” instead of “,” in my CSVs (allowing “,” to be used as a list separator), but there must be a solution to this issue.
I already tried importing the Localization Package in Assets/Packages, removing it from Package Cache, in order to edit it, but this solution simply won’t work, errors will be thrown when I try to load tables on UI.
Did someone already manage to fix this?
We don’t support changing the delimiter in CSV however you can still use commas in your text, you need to encapsulate the text inside of quotes. If you add some text with commas in the table and then export as CSV you will see that its supported. The text should look something like:
Some text,some more text,"Some text with a, comma",etc
I’ve tried this way, but unfortunately it doesn’t work. For my first English(en) column, in the first cell I tried to put the text “yes, hello”. When importing the csv in Unity, I’ll get “yes in the English(en) column, and hello” in the first cell of the next language…
Is there something I’m missing maybe?
I dont have access to the package at the moment to check but could you try adding the text in the String Table editor and then exporting it via csv? See how it compares to your version. The exported version will work, you will be able to reimport it and get the same result with the comma being kept as part of the text.
Okay, thank you Karl, didn’t think of that!
I’ll try in a few hours and get back here, maybe it can help someone else!
EDIT
I may have made some mistake when I first tried to use " to encapsule sentences containing a comma. It works indeed, thank you.
Making Numbers output CSV with comma as a separator instead of semicolon streamlined the import in Unity, as sentences containing commas will automatically be encapsulated in quotes!
Thanks for your help, Karl!