Localized CSV string tables

Hello, I’m trying to use string tables dynamic loaded from CSV files in my project. (Currently, I am using “regular” texts in the game, and I run some scriptlets to generate .po files that the localization team can work with, but I want to stop using these and use only the .csv files.)

However, even with the documentation saying “String Tables provide a way to centralize your localized text into one (or several) known locations, and then reference the entries within a string table from other assets or code in a robust way that allows for easy re-use of localized text.”, it basically stops there, and how to actually implement localized texts using string tables seems necessary to do additional research on Google or ask in the answer hub, like I am doing now. Which is very frustrating…

Anyway, I already able to do some things, like:

  • The CSV files are already being loaded with the game module (I am calling the LOCTABLE_FROMFILE_GAME macro in my StartupModule function)
  • I am able to use the strings in Blueprints

However, to support multiple languages, I have no idea what I should do. I mean, if I copy the .csv files, translate the strings of each row to another language, what should I do with the file now? Should I run some scriptlet? Should I put the new .csv files in a specific folder? Should I configure something? Should I manually load the .csv files for the language I want?

1 Like

As far as I know, you can only use CSV string tables to hold strings in your native culture and reference them in FTexts around the project: BPs and code alike. And that’s it.

When it comes to localization, they’re just like any other type of text (e.g., binary uasset string table entries or in-place FText values): so strings from CSV string tables are gathered just like all other localizable strings by the Gather commandlet, and then the system works as usual. Add cultures you want to localize your game into, Gather, Export (to PO files), […translate…], Import (from PO files), and Compile.

Unreal offers no way to export strings for localization into a CSV file instead of a PO file, nor it offers a way to import localized CSV string tables back if you want to localize CSV string tables directly.

Though it shouldn’t be too hard to write a script to populate target PO files with translations from your localized CSV string tables, really: you’d just have to iterate over PO entries for each culture and replace msgstr with translations from the corresponding translated CSV file (or column), finding the right entry by namespace/id combination which identifies it uniquely (unless you have conflicts, which you should resolve anyway). Might need some processing for escaped chars, not immediately sure about that. Then you could import those POs and have your localized text in the game. Sounds like a hack but it should work just fine.

but how does one load datatable/stringtable from csv on the fly ?

Hey, here’s a nice guide: Localized Strings Using StringTable and C++ · ben🌱ui

1 Like