I want to localize phrases like "Places in {country name}" where the (already localized) country name is dynamically obtained according to the ISO country code.
The problem is that for some country names, an article must be prepended:
- Places in the United States (
en
)
Sometimes in plural form, male or female, capitalized or not:
- Lugares en los estados unidos (
es
) - Lugares en las Maldivas (
es
)
The article might even have to be declined according to the case (nominative, dative etc) of the country name in the phrase:
- Orte in der Schweiz (
de
) - Wir fahren in die Schweiz (
de
for "we go to Switzerland")
Or we even might might a different preposition:
- Orte auf den Malediven (
de
, using "auf" instead of "in" because the Maldives are islands)
Is there either a library or a good set of rules (e.g. regular expression based) that one could use to accomplish this?