Handling rankings?

I am completely inexperienced with smart strings. I am trying to learn them in order to use this neat localization package you offer.

I am doing ok because, in most cases, I managed to find examples to emulate. But in my project I have a particular problem. I need to use rankings, and those differ between languages.

When the player does a high score, I want to display “Congratulations! You made (ranking) place!”.
In English, rankings are : 1st, 2nd, 3rd, 4th, 5th, etc…
In French (my other language before maybe adding others), it’s : 1er, 2ème, 3ème, 4ème, etc…

Is there a smart string or a C# function that could add this suffix automatically according to the locale? And If not, could you tell me how I can access the current locale in the code? That way I could at least code a method manually for this use case, as i know the suffixes in the languages I’m doing.

Thanks in advance for any help you can give me.

Hi,
We currently only support cardinal plurals, what you are talking about is called ordinal plurals and is something we have plans to look into in the future.
You can access the current Locale in code by doing LocalizationSettings.SelectedLocale

I see. Considering I couldn’t find any examples of ordinal plurals, I kind of expected your answer. But now that you provided me the way to read the selected locale, I should be able to do a workaround with a custom method.

Thanks for your quick answer!

1 Like

Hi! Just wanted to check if there were any updates on ordinal plurals support. We’re currently just manually doing English ordinal plurals for everything, but I’d love to move the logic to a formatter that can handle it for the selected locale.

It’s on our roadmap and we have a potential solution which would involve integrating Humanizr. https://humanizr.net
Hopefully we will have more news later in the year.

1 Like

Thanks Karl! I’ll keep an eye out.

1 Like