FInternationalization::Get().SetCurrentCulture not working on iOS

Hello,

We’ve managed to successfully navigate the UE4 localization system and get our game localized.

When launching the game in an editor window we can change the language of the game fine using SetCurrentCulture (although I have noticed this seems to change the language of the editor too).

However when running on iOS8 this does not seem to work, the culture does not change. Calling GetCurrentCulture after attempting to change the culture shows that is has not changed.

The cultures I am attempted to change between are “en”, “it”, “de”, “es” and “fr”.

Is this the correct way to change game language on Mobile? Does it work?

Cheers,

\o/ Congratz on localizing your game.

Let me explain how the system is intended to work.

Currently, the editor never loads game specific localization files. This is important because otherwise you could accidentally get into a state where translations are saved over your source text. Thus instead you need to run your game in stand-alone mode. You can do this through the Play menu in the editor or from the editor startup command line by passing -game. Under the advanced options for the Play menu you can specify command line parameters, so if you’d like to launch into a specific language you can do that by specifying “-culture=en” on that command line.

Obviously a packaged build will always attempt to load game specific loc.

By default the engine will attempt to find localization data that is appropriate for the OS’s desired locale/culture. This should work on all platforms, including mobile. Let us know if this is an issue.

You can hot swap your culture in-game by using the in-game command prompt (open with ctrl+shift+~) and typing “CULTURE=en”.


The engine only has one current culture, thus calling SetCurrentCulture while in the editor will cause it to load different localization data as well.

If calling SetCurrentCulture is causing your game loc to load in the editor you may have configured your game localization targets incorrectly. You should have at least one Game specific loc target separate from the existing Engine and Editor ones. We normally push to have it called ‘Game’ by default.

O and if you didn’t know. You can open the in-game console on mobile by tapping the screen with 4 fingers. (I believe it’s four)

Hi,

Thanks for the quick reply and information.

Changing language on the device does is still not changing our game’s language, and the command you provided is also having no effect. Yet it does work when running in a new editor window.

This is leading me to believe that perhaps the other languages are not being packaged / cooked correctly.

I will look into it more and update here on what we find.

Thanks.

As a side note, do we need to include the Localization directory in the list of Additional Non-Asset Directories to Copy?

I don’t believe so. I think we already handle that.

Which version of the engine are you using? There was a problem in 4.7 and older where the culture changing in-game commands wouldn’t work correctly.

We fixed that with CL# 2532878 in our Main branch.

We are running 4.6. The culture changing in-game command does work when I’m running an editor window version. It’s just not on the device. But the fact that language isn’t changing even when I change the language of the iOS device is telling.

Hi Sarge,

Sorry for the delay in this. I’ve looked into it a little more and I’m really not sure why the culture is not changing. I’ve checked that the ipa does have the localisation files. It is impossible for us to do debug builds on iOS so it’s very difficult to find out what is happening. All I can say is that it does go into the change culture code and appears to come back ok but then culture doesn’t actually change.

I did manage to get it working once, I thought it was by copying the ipa across manually but I’ve just tried that and it still doesn’t work so I’m not sure how I managed to get it to work that one time.

Any advice?

Here’s what my steps would be for narrowing down this problem.

  1. Determine if the engine is detecting the correct device locale. You should be able to check the log for this. It should say what locale was requested and what loc data it decided to load.

  2. If the device locale is correct, but it still fails to load the current loc data, then confirm that the data exists in the build.

This should allow you to narrow down whether it’s an issue with how the engine is detecting the device locale or if it is just failing to discover and load the correct loc data. It’s not particularly clear which is the case from your previous messages.

If it’s a loading problem it could be the handling for a particular locale. For example, Chinese is handled somewhat uniquely as not all devices follow the standard. Thus ‘zh’ isn’t going to load if the iOS device requests zh-Hans-CN or zh-Hans. Instead you need to code your locale to ‘zh-CN’ or ‘zh-TW’.

We’ve experienced this problem with Chinese but it certainly could happen with other locales that commonly introduce script codes into their locale moniker.

Are you having problems with all languages or just one in particular?

We are using the FIGS languages. The device locale is set to English. I’ve added lots of extra logging and I think I’ve at least narrowed down where it’s going wrong.

In FInternationalization::GetCulturesWithAvailableLocalization we are iterating through the directory “…/…/…//Content/Localization/Game”. This folder contains 5 folders (de, en, es, fr & it) and a Game.manifest file.

We then go into IOSPlatformFile, which does not come back with a handle when trying to open the directory.

When it repeats for the engine ("…/…/…/Engine/Content/Localization/Engine") This folder contains 3 folders (en & es). This does return a handle correctly.

I’ve attached a summary of the log information.

link text

Setting Internationalization support to EFIGS in project settings seemed to be the fix.