How Can I Load/Reload Localized Assets at Runtime?

Hello!

We’re using UE 4.13.2 and we have some localized assets (maps, meshes, textures, and most importantly: dialog waves played through sound cues).

Our text, map, mesh, and texture localization appears to work correctly when the culture is changed at runtime via FInternationalization::Get().SetCurrentCulture(“xx-XX”), but the localized dialog waves don’t get loaded unless either the game is started with -culture=xx-XX or we add the SetCurrentCulture(“xx-XX”) to our custom gameinstance’s PostInitProperties().

This is undesirable as we need to be able to support starting with our main menus in a certain culture, and then change to any arbitrary culture (selected via the menus) when the game itself is started. I had originally just planned on writing the code to dynamically load our assets (for the dialog waves we’d make a localized sound cue which references the correct dialog wave for each culture) as needed, but when we found out about the asset localization system in 4.12 and beyond, we hoped this would handle it for us.

Is there anything I can do to potentially force a load or reload of the localized dialog waves, is there a different way I could go about this, or should I go ahead and write my own system to dynamically load these?

Thank you!

We don’t currently have support for content hot-reloading at runtime, so unfortunately the only way to reload localised assets after changing the culture is to make sure they’re purged and loaded again. If you’re only in your main menu then this might just be a case of reloading your main menu world, however any globally loaded references may cause issues that require a restart.

Hi Jamie,

regarding “globally loaded references”:
If I have a few array variables in Blueprints within the persistent level that are referencing textures and WAV files - does that mean that all these textures and WAV files are already loaded into memory just because they are listed within that array?

It’s the year 2021 now and Fortnite got perfectly localized into tons of languages - So, is there a better method for localizing text, textures and sound files now?

Thank you!

Whether they’re automatically loaded would depend whether they’re a hard or soft reference. Hard-references are loaded with the asset, soft-references may be loaded later on-demand.

Sadly we’re still in the same place regarding asset reloading at runtime. If you know which packages you need to reload, you could try calling ReloadPackage/ReloadPackages and hook into the FCoreUObjectDelegates::OnPackageReloaded callback to update any references it doesn’t pick up automatically.