The name to display will be chosen at runtime.
For now, to display the correct name I need to wait for name to complete the GetLocalizedString async operation. It may need an entire frame because synchronous localization is not done yet.
Then I need to wait for dialog to localize with the provided argument, which also may require the entire frame.
Such behavior will produce noticeable text popping on the screen while localization is loading.
What is the right way to localize arguments?
Is there a way to localize like this: “Hello {Names.name_tim}!”?
Ps
Example is synthetic, actual use is a bit more complex.
I’ve read all manual and didn’t find anything related
You can mark your tables as preload https://docs.unity3d.com/Packages/com.unity.localization@0.11/manual/StringTables.html#preloading
Look at the Samples we have, one shows how to wait for preloading to complete. Once preloading is done then strings will be returned during the same frame.
Do you plan to localize the names? We do plan to support embedding localized values like this in the future, the synchronous support is the first step towards this.
For now it sounds like preloading should solve your problems.
I made a workaround in the past. I grabbed source code of the package and created the embedded package (placed source code inside Packages folder).
This way I was able to create required code and call these internal methods.
Now the problem with this solution is: I can’t easily upgrade to a newer version of the localization package:(
Is there a better way to properly add entries to tables?
Hi,
Not at the moment but it’s something we should support. I’m not sure exposing the events is the answer though, we should just update when you call the add method. Could you file a bug report?
I think we will probably move some of those events directly into the tables and make them static so they can be called directly by the tables so you won’t need to call them. So I would not use the events anymore and wait for the fix unless it’s a problem in which case carry on calling the event for the moment. Hopefully we should have a new release in a few weeks and ill try and get this in with it
Not really. When I rename a entry from the code, the table goes to None (String). I call SetDirty, but it doesn’t give any result. I thought there must be a way to update the table