angular-translate / angular-translate

DEPRECATED Translating your AngularJS 1.x apps
https://angular-translate.github.io
MIT License
4.33k stars 1.04k forks source link

How to translate a list of things (e.g. apples, oranges, and bananas) #1561

Closed cudasteve closed 8 years ago

cudasteve commented 8 years ago

Subject of the issue

Forgive me if this is obviously outside of the scope here, but is there (or should there be) a way to handle translation of arbitrary length lists? In english I might say "apples, oranges, and bananas," but I assume in other languages the rules for constructing such lists are likely different. And ideally I'd like to be able to have the translation engine or parser gracefully handle the case when that list becomes "apples and bananas," "grapes, apples, oranges, and bananas," or simply "apples."

I see in messageformat, that there's one extension for offset, but that doesn't meet this need. I'm curious if we could add an extension for this?

Your environment

A demo to give an idea: https://plnkr.co/edit/ILohm6oy0ifcIJkXZVsA?p=preview

This doesn't have messageformat installed in it since I know that won't work, but hopefully you get the idea of what I'm looking for here

Expected behaviour

Some expression like {items, plural, list:and other{,}} would create something like "apples, bananas, and oranges"

Actual behaviour

This doesn't exist

knalli commented 8 years ago

IMHO, the messageformat related question has been answered at the other issue already.

Assaf1978-boop commented 11 months ago

Seems,interesting.!!!!!!!! Seems,nice.!!!