Localization smart string. Error parsing format string: Could not evaluate the selector "Artillery"


Basiclly I’m referencing another localized string in one, and add a bold richtext tag.
8481428--1127702--upload_2022-10-1_15-40-53.png
In preview, it works well.


When I use localizedString.GetLocalizedString, it throws me error.
The local variables I set in the editor, should work right away? Or I still need to pass it to the method?

The local variable is part of the LocalizedString. The String Table is not aware of this information.

Its

LocalzedString → LocalVariables → StringTable.GetLocalizedString

When you call StringTable.GetLocalizedString directly you miss out the part where the local variables are passed in.
We pass them in by assigning them to the FormatCache before we call GetLocalizedString.

You should do: localizedString.GetLocalizedString() instead.

I am using this code in Editor script OnInspectorGUI function. My code localizedString.GetLocalizedString() returns null, while they are working in the property drawer.

This will be because there’s no active locale. You can set the LocaleOverride field in the localized string instead.

localizedString.LocaleOverride = LocalizationEditorSettings.GetLocales()[0];
I’m using this for a specific LocalizedString in the Editor code, but I didnt find a way to set a global locale default.
Hope this can help someone who comes in the future,

1 Like