Is it possible to import localized text from external files?

I already have entire text of game localized. It’s stored in simple text files with extensions like .enu, .plk, .ita.

I only found advices about getting localized text from code/blueprints into .archive and .locres files. But that’s useless for me since I’ve entire translation ready in several languages.
I found some .po files, so I quickly converted my files into this format. And then… is there any way to import such data?

We’ve got preliminary documentation in the works now, but I can shed some light on it in summary here.

  • Manifest files store a dictionary of the text in your project.
  • Archive files store translations (to-be-translated and already translated).
  • Portable Object (*.po) files also store translations, but are a preexisting format that’s common with translation services.
  • LocRes (Localization Resource) files store them the translations in an optimized form for use by the engine.

If you’ve converted your translation files to the portable object format, then there’s a good chance you can very quickly and easily import them into the archive files.

  1. The basic setup is that you need to make a localization configuration script similar to the ones found in “Engine/Config/Localization”, specifically something like the “Engine.ini”.

  2. You then run it by running the editor with a commandline like MyProject.uproject -Run=GatherText -Config=./Config/Localization/MyProject.ini. Typically, this will generate/update manifests, archives, portable objects (*.po), and locres.

  3. If you drop your portable object files into the same directory as the archives it should go to, then they should be imported, then replaced by new portable objects that are an exported version of the archives.

  4. You can then test by running the game (not the editor) in that language - try passing -culture=pl or -culture=it to the game, for example.

That is the gist of it. Far more thorough and friendly documentation is coming soon.

You’ll probably have additional questions as you approach this without said documentation, so feel free to comment on this answer for help.

UPDATE: Localization Documentation

Well, I’d use little help as this system is still mystery for me :wink:
I run the editor with this commandline. The log says script was completed with success. Well… my loc files didn’t change :wink:

Tell what’s my mistake :wink:

  1. I put config files into MyProject\Config\Localization. I created a new file called Game.ini (based on Engine.ini) which refers to all my loc data. I copied following files: PortableObjectExport.ini, PortableObjectImport.ini, RegenerateGame.ini, RepairData.ini, ResourceFileGen.ini, WordCount.ini. I removed sections referring to engine loc files. And replaced references to “Engine” with “Game”.

  2. I created folder MyProject\Content\Localization\Game with subfolders like \en, \it, etc. I copied files from Engine\Content\Localization\Engine. And I just overwrite English version of Game.po with my content.

  3. I created a bat file with content: D:\UE4\Engine\Binaries\Win64\UE4Editor.exe D:\UE4\MyProject\MyProject.uproject -Run=GatherText -Config=./Config/Localization/Game.ini

  4. I got error: Failed to write manifest to …/…/…/MyProject/./Content/Localization/Game. So I changed paths in .ini files from “./Content/Localization/Game” to “Content/Localization/Game”.

  5. Now script completes its life with “Success!” message, but my loc data didn’t changed at all :wink:

And this is my Game.ini.

I don’t have proper manifest file and archive yet.

And I don’t want to get any data from assets at this point. That’s why I put Shapes folder as dummy path :wink:

Is it right to put PO import after “Write Manifest” and “Write Archives”?


;Gather text from assets

;Write Manifest

;Write Archives

;Import localized PO files

;Write Localized Text Resource

;Export  PO files

Yes, it is appropriate to import after writing. The import step can actually be run separately as it looks for an existing archive and updates it. This configuration is just an easy way to do everything in one fell swoop.

You say that Shapes is a dummy path - you can just not gather from assets at all, but this should be fine. However, the only Gather*From* step you have is from assets and you specified a dummy path, so nothing will be gathered at all. The system needs to know what text exists to be translated (manifest) so that it can map the original text to the translations (archives) and build the locres. Don’t you have source code you want to gather from?

Note: AnswerHub doesn’t seem to like backslashes, so you paths look odd, but I’m inferring what they are and they look right.

  1. Sounds correct.
  2. Don’t copy the engine localization data into the game localization data. It will arbitrarily bloat your archives with translations it doesn’t need. The manifest will be nuked each time, so that won’t matter, as will the locres. Replacing the *.po with yours is correct.
  3. That seems right, but based on…
  4. … your issue here, I think the working directory is off. Try making a shortcut instead of a batchfile? The “./” at the beginning if the paths is not incorrect. I’m not sure what the result of removing it actually is, but…
  5. … I must assume that your localization data is being output to a different directory somewhere else.

For clarity, which version of UE4 are you using?