Permalink
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (58 sloc) 4.49 KB

ICU MessageFormat

ICU MessageFormat is a flexible yet powerful syntax to express all nuances of grammar for each language.

Overview

Format Example
Simple text Refresh inbox
Variables Attachment {name} saved
.. icu:: plural

Plurals

  • Using language specific plural forms (one, other):

    {count, plural, one {Message} other {Messages}}
    
  • Using exact matches (=0):

    {count, plural, =0 {No messages}
                    one {# message}
                    other {# messages}}
    
  • Offseting plural form:

    {count, plural, offset:1
                    =0 {Nobody read this message}
                    =1 {Only you read this message}
                    one {You and # friend read this message}
                    other {You and # friends read this message}
    
.. icu:: select

Select

{gender, select, male {He replied to your message}
                 female {She replied to your message}
                 other {They replied to your message}}
.. icu:: ordinal

Ordinals

{count, selectOrdinal, one {1st message}
                       two {2nd message}
                       few {3rd message}
                       other {#th message}}
.. icu:: number

Numbers

You're using {size, number, percent} of you quota
.. icu:: date

Dates

Today is {today, date}