Plurality in user messages

前端 未结 25 1520
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 01:53

Many times, when generating messages to show to the user, the message will contain a number of something that I want to inform the customer about.

I\'ll give a

25条回答
  •  醉话见心
    2021-01-30 02:41

    I depends on how nice a message you want to have. From easiest to hardest:

    1. Re-write your error message to avoid pluralization. Not as nice for your user, but faster.

    2. Use more general language but still include the number(s).

    3. Use a "pluralization" and inflector system ala Rails, so you can say pluralize(5,'bunch') and get 5 bunches. Rails has a good pattern for this.

    4. For internationalization, you need to look at what Java provides. That will support a wide variety of languages, including those that have different forms of adjectives with 2 or 3 items. The "s" solution is very English centric.

    Which option you go with depends on your product goals. - ndp

提交回复
热议问题