Is it possible to load and apply a CSV file (the one exported from Unity)?
Our usecase is to download the CSV from server and use it at the start of the application. I haven’t found any way to “dictate” which CSV the Localization should use.
Hey, thanks for the quick response. I’ll make sure to look at the resources you’ve kindly provided.
I’ve managed to come up with a solution, which loads it in Unity Editor and can be mounted to MonoBehaviour (but what I understand from your message, this will not work in an actual build).
I will post the code, though, it could be useful for somebody one day.
private void Start()
{
// Import from CSV file
var collection = LocalizationEditorSettings.GetStringTableCollection("UI Text");
using (var stream = new StreamReader("path/to/CSV"))
{
Csv.ImportInto(stream, collection);
}
}
Yes this wont work in player, its using Editor only API and will give you scripting errors when you try and build the player.
There’s some examples here on updating CSV through a script in the Editor Class Csv | Localization | 1.3.2
We are just preparing 1.4, when this is released next month take a look at ITablePostprocessor. This will let you make changes to a table when its loaded but before its first used. Its designed for things such as loading in a csv file to patch the table.