I'm looking for advice on how to properly internationalize an enumeration string in . In my case, the app is looking for some info according to user input, but it makes multiple attempts. I want to report these attempts when there is no result, like this in English: "no result, searched for 'foo' and 'bar'". I could have a string like "searched for '%s' and '%s'", but there might be more than two words.

Suivre

More precisely, I want to be able to translate that, anl I'm afraid that simplay translating the beginning of the sentence, the comma and "and", separately, will not work for every language.

Also note that "foo" and "bar" should not be translated.

@roptat
"No result found for %1$s and %2$s"

Does this solve your issue ?

@ButterflyOfFire what if there are three things? I want to show "no result, searched for 'foo', 'bar' and 'baz'".

"%1$s" was a good advice though, I forgot about them ^^'

@roptat i'm afraid it's not possible to have it in a single string resource if you don't have an upper limit for replacements, as you'd need some logic for the repetition.

the next option would be, like you said, to split the sentence into two strings.
one for the general sentence (placing %s at the appropriate place) and one for the actual enumeration. i think this should work reasonably well for most languages.

@roptat you could also use quantity strings for the enumeration to cover cases where languages handle enumerations of one, two or more items differently. and if you need more than 3 items you could append them by a string like "and %s" indefinitely in code. but, as you said, that part might not work for all languages 😕

anyway, as long there are no languages where the outer sentence kinda breaks INTO the enumeration, it should at least work for up to 3 items.

Inscrivez-vous pour prendre part à la conversation
Framapiaf

Le réseau social de l'avenir : Pas d'annonces, pas de surveillance institutionnelle, conception éthique et décentralisation ! Possédez vos données avec Mastodon !