Hi, today I’m trying to use localization package, but having some issues, when I’m trying to use
var op = LocalizationSettings.StringDatabase.GetLocalizedStringAsync(
"NotificationsDescription", str);
so if this key is not found inside NotificationsDescription table, it just returns: No translation found for ‘{key}’ in {table.TableCollectionName}
What I want to do, is to create fallback for this, For example: if key “Hello World” is not found in some locales, I want to write Hello World as a fallback. Is it possible to do without checking op.startsWith(“No translation found for”) and if that happens, just write fallback.
Fallbacks are for when a language does not have a value we then fallback to another language that does. To determine what language to fallback to we check if the current locale has a fallback metadata attached. So you could add the fallback to all your locales so that they fallback to English and this should give you what you are looking for.
https://docs.unity3d.com/Packages/com.unity.localization@1.0/manual/Locale.html
Oh, yes, I did not find this settings. Saw fallback option but did not find how to use it. Now it makes sense, you have to assign each locale their fallback. In other editors, like xcode you can have one default fallback, but I think this implementation is better for some cases.
Thank you for quick response!
1 Like