#Localisation fallbacks not working, even with a manually coded solution.

1 messages · Page 1 of 1 (latest)

onyx current
#

Hi,
When trying to call GetLocalizedString(table, key) with an untranslated locale (which, to my understanding, should automatically fall back to the fallback language) on a localisation table entry with an English translation and nothing else (so, the other locales have an empty entry), I get an empty string, not the English string as expected. (image 1: example of the localisation table). (image 2: relevant project settings).

I also tried coding my own fallback:

//in start:
_english = LocalizationSettings.AvailableLocales.GetLocale("en"); //confirmed correct

//in my local changed handler:
string localisedText = LocalizationSettings.StringDatabase.GetLocalizedString(LocalisationTable, LocalisationKey);
            if (localisedText == null || localisedText == string.Empty)
            {
                localisedText = LocalizationSettings.StringDatabase.GetLocalizedString(LocalisationTable, LocalisationKey, _english);
            }
            _text.text = localisedText;

but for some reason, the fallback attempt always returns an empty string even though there is an english translation for all these strings.
If I turn on log warnings, I get this when I try to set the locale to one other than english: (image 3).
This makes no sense to me, as there is clearly a valid English translation for these strings, as they are shown when the locale is set to English. Not sure if this is related to the fallbacks not working or not, but it's quite confusing.

onyx current
#

ah, so it seems to be because I didn't specify a fallback locale in the locale asset themselves, which is required for empty translations (not missing ones) to work.