Plurality in user messages

前端 未结 25 1880
没有蜡笔的小新
没有蜡笔的小新 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

    For English, plenty of answers above. For other languages it is more difficult, as plurals depend on the gender of the noun and the word ending. Some examples in French:

    Regular masculine:

    Vous avez choisi 1 compte. Voulez-vous vraiment le supprimer.
    Vous avez choisi 2 comptes. Voulez-vous vraiment les supprimer.
    

    Regular feminine

    Vous avez choisi 1 table. Voulez-vous vraiment la supprimer.
    Vous avez choisi 2 tables. Voulez-vous vraiment les supprimer.
    

    Irregular masculine (finishes with 's')

    Vous avez choisi 1 pays. Voulez-vous vraiment le supprimer.
    Vous avez choisi 2 pays. Voulez-vous vraiment les supprimer?
    

    The same problem exists in most Latin languages and gets worse in German or Russian, where there are 3 genders (maculine, feminine and neuter).

    You'll need to take care if your objective is to handle more than just English.

提交回复
热议问题