No suitable formatter could be found

Hi there!
I am using Localization 1.3.2 (faced the same problem on 1.3.1 and 1.4.0exp1) and Unity 2020.3.17f1.
I have a smart string on a TextMeshPro, where the variable is linked to a component of another gameobject:
Your current VIP status will expire after {tooltip.expirationTime:time(short)}. Make a purchase to renew it.
The parsing works fine in English, but throws an error on all the rest of the languages, even with exactly the same string.
Any ideas on what I may be doing wrong?

Thank you.

Hey so I just saw that, and I understand that, what I am trying to fails because time values cannot be translated. So my question is, what use is this tool for?

So, the way I understand this, I’ll have to write a custom formatter for localizing the time in other languages.
Searching around, I stumbled upon TimeSpanUtility.cs where at the end of the file, I saw this


I guess all one has to do is expand that switch statement and include more properties that return TimeTextInfo in a proper way for the language they want to include.

But then again, it is too risky writing code there, cause with the next update of the plugin it will be overwritten.
So what is the suggested approach?

You want to localise the text such as weeks, days etc? We have some improvements in 2.0 to help with this a little but it’s going to be some time for that. You could write a custom formatter and copy that code plus your own changes. Then it would be fine updating in the future.
https://docs.unity3d.com/Packages/com.unity.localization@1.3/manual/Smart/Creating-a-Custom-Formatter.html

Hey Karl, thanks for your reply!
Ended up dumping this Formatter and translating time manually for each occurrence of a time value.
It seems that at its current state the TimeFormatter is of no good use.
I hope you guys get to upgrade that feature in the future.
Cheers :slight_smile:

1 Like

Ah sorry to hear that. How would you expect it to work ideally? Any feedback would be great.

Hi, just found out the same way that Time format do nothing.

To answer @karl_jones question. I would like that if I change language, it behave like in english but for all languages.

So in french instead of 2 hours, you get 2 heures.
And so on for each languages, and I assume language that are right to left like arabic have their own way to present it

We probably wouldn’t be able to do that as it would require having the translations for all languages built-in. We could maybe do some core languages. Ideally we would want to be able to connect the values to string table entries so translations can be provided for any language.
I’ll add a task to look into this in the future.