I’m rather stumped at the moment. I initially had a problem where the localization wouldn’t load any strings at all. After marking the localization asset as addressable and rerunning the addressable build and analyze tool it worked. I then proceeded to add 6 more languages to the game, and on the menu depending on the flag you click I set the selected locale with the following line:
LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.GetLocale(locale);
//locale being passed in as either "en" or "ar" etc.
It works fine in the editor, but when I build the project and run it, it always seems to present the English translation no matter which option I pick.
To top it off, I’m running into these “Unfixable” issues and I can’t seem to find any solutions online.
After marking the localization asset as addressable
What asset? Don’t mark the Localization settings asset as addressable, it does not need it and may be the reason for things going wrong. You may end up with 2 Localization settings in a build which would conflict.
The Bundle Layout Preview rule just shows you what asset bundles the assets will go into, it does not mean something is wrong. Putting it under Unfixable rules does seem to imply that something is wrong but its not.
Thanks for the insanely fast response @karl_jones . I’ve marked all of the locale assets as addressable, and the localization settings asset is not marked as addressable but to no avail. Please advise:
Apologies, I didn’t reply directly to your answer. To also add to the below answer that I posted, I did follow the 5 issues you listed under the addressable issues thread but no luck unfortunately
Hmm cant see anything to help. Have you tried using the Locale selector that comes in the Localization package Samples? Does that one work? It may be that you need to wait for the initialization operation.
Can you check the value returned by LocalizationSettings.AvailableLocales.GetLocale(locale);
Is it null?
That actually helped me narrow it down a bit thanks. So basically in the editor it has a value based on the locale, but when I try printing it out in the build itself I get this error on the logs:
Locales PreloadOperation has not been initialized, can not return the available locales.
NullReferenceException: Object reference not set to an instance of an object
at LanguageSelector.Update () [0x0003d] in <09178970fdf74b198a385ba5eb2f0ee7>:0
Can you please provide some guidance as to how I can go about resolving this?
Select the LocalizedStringEvent and expand the StringReference field. You should see a toggle for WaitForCompletion. It should be off. Do you have the callstack for the error? It can also come from calling one of the Asyncronous methods such as GetLocalizedString instead of GetLocalizedStringAsync
Thank you for your guidance Karl. By toggling all the settings and replacing GetLocalizedString with the asynchronous call it fixed all of the issues.
One last (hopefully minor) question I have is as to why Chinese / Arabic / Hindi characters don’t render on WEB GL at all? Portugeuse / Spanish / French works like a charm and on the windows build I can see the Chinese characters.
I’m assuming it has something to do with the fallback fonts. Would this display correctly on people who are running browsers that support the respective languages?
Are you using the default unity font? I believe it is different per platform. You should pick fonts for each language that you know have all the characters you need regardless of the platform.