Localization apply delay

I have localization like this and its work almost perfectly:

But when on device default localization isnt english after start of the app users see english version of the text for ~ 0.1s and after it changes to right language.
On second load of the scene (without reboot app) all text in correct language from start.
How I can fix this?

1 Like

This is due to the Addressables loading. We do it asynchronously which means Unity can still run whilst the loading is happening.
You have a few ways to handle this.
Preloading will allow you to mark tables to be loaded at start, this will mean that things should be immediately available.
You will still need to wait for the initialization operation to complete for Preloading. You can either implement a loading screen for this, check the package samples for an example.
You can also set the LocalizationSettings to Initialize Synchronously(Project Settings/Localization) which will force the InitializationOperation to complete immediately when it is started but this will mean the main thread is blocked, this can make the app appear to be unresponsive if its loads a lot of data.

2 Likes

Hi @karl_jones

I found this thread since I was experiencing exactly what was described above. It seems that the UI has changed, so the instructions in the Preloading section (in the latest version 1.5.0-pre.6 of the documentation) canā€™t be followed for preloading the tables.

The closest Iā€™ve found to this is in the localization settings, under ā€˜Preload Behaviorā€™ and ā€˜Initialize Synchronouslyā€™:

Unfortunately, when hitting play, the default English locale shows and after a small delay (0.5s-1s) it changes to Chinese, which is set for testing in the Awake function (I also test it on the Start function with a similar result).

1 Like

The preload option has moved to the main table window, just under the top where you select the table. Itā€™s supposed to be easier to find :sweat_smile:
The option is now applied to all tables instead of per table.

We will get the docs updated before we come out of the pre-release

1 Like

Are we talking about this window? Sorry, I only know the ā€˜LocalizationTableā€™, ā€˜localesā€™, and ā€˜LocalizationSettingsā€™ windows. I bet itā€™s got to be something easy to find so my apologies

Yes although that screenshot is from a pre 1.5 version. In that, you need to click the metadata button {@} next to the locale name

1 Like

Thank you for the walk-through, I managed to get it working :slight_smile:

So, a quick summary. Assuming youā€™re not using a custom loading screen and want to preload the tables so that the first thing you see is the correct locale already loaded based on SystemLanguage or userā€™s preferences (so that you donā€™t see that glitch-like language change on app launch).

For this to work, there seems to be 3 steps needed:

(1) The Preload Table checkmark of your target table(s) or the Preload All Tables checkmark enabled in the metadata button ({@}) of the ā€˜LocalizationTablesā€™ window.

(2) The Preload Behavior set to Preload your Selected Locale(s)/Fallbacks or Preload All Locales in the ā€˜LocalizationSettingsā€™ window.

(3) The Initialize Synchronously checkmark set to ā€œenabledā€ in the ā€˜LocalizationSettingsā€™ window.

2 Likes

We also have an example that shows how to do a loading screen in the package samples. They can be accessed from the package manager.

1 Like

Thereā€™s no ā€œpreloadā€ checkbox in the UI of that window. Iā€™m on 2022 LTS

What version of the package are you using. Try updating to 1.5.3. if itā€™s not visible in the package manager you can update the manifest.json file in the a Packages folder.
Otherwise you can look in the Metadata for the table by clicking the little icon next to the language. We moved the option in 1.5.

It worked as expected when I followed all these 3 steps. Thanks Guirie. Unity v2022.3.37f1.
Preload nicely done and game started with selected locale.
Btw, Karl: Localization 1.5.3

2 Likes