The acceptable keys for variables are:

    • one
    • "=x" where x is a number
    • "<x"
    • other
    • format

    Example:

    1. # Using variables in raw string
    2. YouLate: "You are %[1]d ${Minutes} late."
    3. # [x] is the argument position,
    4. # variables always have priority other fmt-style arguments,
    5. # that's why we see [1] for houses and [2] for the string argument.

    You can select what message will be shown based on a given plural count.

    Except variables, each message can also have its plural form too!

    • zero
    • one
    • two
    • "=x"
    • "<x"
    • ">x"
    • other

    Let’s create a simple plural-featured message, it can use the Minutes variable we created above too.

    1. FreeDay:
    2. "=3": "You have three days and %[2]d ${Minutes} off." # "FreeDay" 3, 15
    3. one: "You have a day off." # "FreeDay", 1

    Let’s continue with a bit more advanced example, using template text + functions + plural + variables.

    1. Vars:
    2. - Houses:
    3. one: "house"
    4. other: "houses"
    5. - Gender:
    6. "=1": "She"
    7. "=2": "He"
    8. VarTemplatePlural:
    9. one: "${Gender} is awesome!"
    10. "=5": "{{call .InlineJoin .Names}} are awesome."