Hi, I’m using Unity 2021.3.16f with the Localization package 1.3.2
With the LocalizedString.IsEmpty I check if the LocalizedString is asigned or is left empty. But now I need to do a second check, that is: If the key have a translation for that Locale or is left empty.
Actually I’m receiving No translation found for ‘Key’ in Table Collection Name
I’m sure there is a clean way than check if the received string starts with “No translation found for”
Thanks in advance! 
Other than checking the returned value you could get the actual string table and query the entry to see if it exists and if it’s not empty.
You could also hook Into the LocalizationSettings.StringDatabase.TranslationNotFound event which will get called for all missing translations.
https://docs.unity3d.com/Packages/com.unity.localization@1.4/api/UnityEngine.Localization.Settings.LocalizedStringDatabase.html
1 Like
Okey everyone, an easy solution is configure the parameters MissingTranslationState and NoTranslationFoundMessage in LocalizationSetting.
That can be done, via the asset you created (LocalizationSettings (asset) → String Database → Missing Translation State & No Translation Found Message) or via script like this:
LocalizationSettings.StringDatabase.MissingTranslationState = MissingTranslationBehavior.PrintWarning;
LocalizationSettings.StringDatabase.NoTranslationFoundMessage = "No translation found for <b>'{key}'</b> in <b>{table.TableCollectionName}</b> in <b>{locale.name}</b> language";
In my case, I disabled Show Missing Translation State in the MissingTranslationState for receive an empty string when there is no translation setted for the active locale.
Now, @karl_jones , I still don’t know how get all the translations (string) via just having a
LocalizedString.
I learned how to get the current Locale translation with this code:
// LocalizedString localizedString is a parameter of a method
LocalizedStringTable localizedStringTable = new LocalizedStringTable(localizedString.TableReference);
StringTable stringTable = localizedStringTable.GetTable();
StringTableEntry stringTableEntry = stringTable.GetEntryFromReference(localizedString.TableEntryReference);
string value = stringTableEntry.Value; // or .LocalizedValue to get the string with the formatting applied
Now I need to get all the non current Locale translations.
Oh yes good idea.
You can set a LocaleOverride on the LocalizedStringTable,.this will let you get the value for a different locale.