Problem with Czech language

Splash Forums PrettyTime Users Problem with Czech language

This topic contains 5 replies, has 3 voices, and was last updated by  Lincoln Baxter III 8 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #19135



    i’m from Czech republic and czech language is pretty complicated (like many other slavic languages). I would realy appreciate if I can set up unit singular and plural form separately for future and past.


    English: 1 month ago

    Czech: Před 1 měsícem

    English: 1 month from now

    Czech: za 1 měsíc

    English: 2 months ago

    Czech: Před 2 měsíci

    English: 2 months from now

    Czech: za 2 měsíce


    Singular – month – měsícem

    Plural – months – měsíci


    Singular – month – měsíc

    Plural – months – měsíce

    Is there any other way to achive this behavior?


    Hi There,

    Yes, this is possible, but it hasn’t been added to the translation guide yet because we haven’t gotten much feedback on the API – you could help us out by being among the first to try it!

    Basically, the concept is that you need to implement the TimeFormatProvider interface in your ResourceBundle.

    * Produces time formats. Currently only to be used on Resource bundle implementations when used in
    * {@link ResourcesTimeFormat} instances..
    * @author <a href="">Lincoln Baxter, III</a>
    public interface TimeFormatProvider
    * Return the appropriate {@link TimeFormat} for the given {@link TimeUnit}
    public TimeFormat getFormatFor(TimeUnit t);

    This allows you to handle formatting uniquely for each unit, and thusly, also allows you to do do things like supply a different name for past, future, plural, or singular. The downside here is that the API is pretty low-level, so you need to do a bit of work.

    It may be possible just to add some additional entries in the resource bundle “PastPluralName” “FuturePluralName” PastSingularName” “FutureSingularName”. But this is currently not implemented. If these special fields were not provided, the format would need to fall back to the current schema. Would this solve your problem?

    Thank you for trying, and thank you in advance for your feedback!



    Update, I’ve implemented this feature and documented it in the translation guide. You can now specify Future and Past Plural and Singular names for each time unit.

    Translate for your Language



    Also, please let me know if this solves your problem :)


    Martin Kouba

    FYI singular and plural form is not enough for Czech lang. I’ve just sent a pull request with resource bundle and test:

    It would be nice to have the API poweful enough to handle similar requirements – right now every bundle has its own solution/workaround. But I know it would be pretty difficult 🙂



    Yeah, I know :/ It’s so complicated that it is indeed very difficult to provide a standard API. I’m sure that there are linguists out in the world who understand the needs of most languages, but unfortunately I’m not one of them 🙂 So I’m open to ideas.

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘PrettyTime Users’ is closed to new topics and replies.

Comments are closed.