New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate ordinals (1st, 2nd...) into several languages [de, es, fr, it, ja, ko, nb, nl, pt, ru, sv, uk, zh] #153
Comments
|
Hey @soywiz, it's not quite easy for example for Russian because the ending of an ordinal depends on the gender of the word after it. For example: let's take two words with different gender:
Reference: https://en.wikipedia.org/wiki/Ordinal_indicator#Russian Maybe for some other languages the same is true. So how we should solve it? |
|
I see. I was not aware of that! We could provide something like LocaleContext, and then populate it with extra information, like gender or other stuff, so it is extensible to support several languages and we don't have to hardcode them for parameters. But first of all, this library is just for dates, and there is no Locale concept in the Kotlin standard library just yet: |
Which exactly "date numbers"? I've just come up with two variants and realized that we also use the suffix of neuter gender sometimes for ordinals in Russian
So I need to know in which sentence the result of |
|
UPD: realized that it seems it's not the case for 1..31 ordinals, because a date is another thing, we can easily say for example 100th date. So please forget about date :) |
|
Would this work for you? class KlockLocalContext(...)
fun KlockLocalContext.withGender(gender: KlockLocaleGender): KlockLocalContext
enum class KlockLocaleGender {} // What about non-binary, etc.? Are used in any supported language?
open fun getOrdinalByDay(day: Int, context: KlockLocalContext = EmptyKlockLocalContext): StringEdit: so in the end is it required for Klock? Still this discussion could help if someone is making or willing to make a Locale library, or if the Kotlin team plans to add Locale support to the std library at some point |
Yep, for Russian two genders of ordinals seem to be used in "date numbers": masculine and neuter.
Seems like it will work for Russian. I can try opening a PR for KlockLocaleGender, KlockLocalContext, and Russian ordinals. OK?
Just a wild guess: dates appeared in languages quite long ago so there are no dates with non-binary gender in different languages. Of course I can be wrong, but I think other genders can be added later if needed |
|
Sure. Feel free to open a PR. Additionally, could you ask someone from Russia to review the PR too when available? |
Translate ordinals to Russian (korlibs/klock#153)
|
So korlibs/korge-next#191 is merged, a tick can be placed here |
|
Done! It will be available on next version once I integrate changes from korge-next |
klock/klock/src/commonMain/kotlin/com/soywiz/klock/KlockLocale.kt
Lines 20 to 33 in ca25e8a
#150
The text was updated successfully, but these errors were encountered: