Import CSV localization file containing strings with commas?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NerdP
:warning: Old Version Published before Godot 3 was released.

Hello! I have strings for my game which contain commas. But Godot import CSV files with only commas as delimiters. How can i import my strings into project?
Thanks!

Try to use " signs in your localization files, like "some, text 1", "some, text 2" let me know if it works so I could convert this comment to answer

kubecz3k | 2016-06-13 15:00

Yes, thanks! It works!

NerdP | 2016-06-13 19:15

:bust_in_silhouette: Reply From: Warlaan

How are you importing the CSV files? When I search the API for “csv” I only get this function which allows to specify the delimiter.

That official manaul for localization
http://docs.godotengine.org/en/latest/tutorials/engine/internationalizing_games.html

NerdP | 2016-06-18 15:52

:bust_in_silhouette: Reply From: mokalux

hello,

the way I did it was :

  • using MS excel (you can use similar prog)
  • making some formulas which would combine my texts between “” for each languages
  • select the columns id, language01, language02,…
  • copy and paste in notepad
  • saved the file in .csv (UTF8)
  • finally imported in GODOT.

Voilà.

example :
id,fr,en
s112,“112. Le monothéisme pur (Al-Ihlas)”,“112. Ikhlas, or Purity (of Faith)”
s113,“113. L’aube naissante (Al-Falaq)”,“113. Falaq, or The Dawn”
s114,“114. Les hommes (An-Nas)”,“114. Nas, or Mankind”

Hope this helps.

Thanks! It works for me

NerdP | 2016-06-13 19:17

I’m posting this because I think you can make life a lot easier for yourself. I am however writing this with no experience of localisation or using CSV in Godot. My experience with this issue was years ago and in C++, and I was writing my own parser.

If you can specify the delimiter in Godot - which it seems you can, I would suggest Open Office over Excel. Open Office allows you to use any character as the delimiter when exporting to CSV, so you can choose something that doesn’t occur anywhere in your text. (If this has changed in more recent versions of Excel, forgive me.) This also spares you the need to enclose the contents in quotes, which massively simplifies parsing. I haven’t any experience with CSV in Godot, so I am assuming the quotes aren’t required (which may not be the case).

For example, I used the $ character as the delimiter in an application that generated .chm files out of a 16k row spreadsheet. Using commas was problematic, as the contents was all plain text. Handling quotes was an issue, because quotes were also used in the texts and escaping them would have been a massive PITA. Many other special characters ( like pipe (|),hash (#) etc.) were also no-gos as this was technical documentation, so they occured in the content as well. I chose $ for the simple reason that there was not a single occurrence of the character, which massively simplifies parsing. Excel would only let me choose characters that were already in the text as the delimiter :frowning:

You shouldn’t need to use formulas should you? Each row and column in your spreadsheet will be separated by your specified delimiters when you export, and you can choose to add quotes around the cell contents when exporting in both Excel and Open Office.

steevm | 2016-06-17 22:09

:bust_in_silhouette: Reply From: kubecz3k

Use " char in your localization files, for example: "some, text 1", "some, text 2"