4

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?

3
  • 3
    I'm voting to leave this question open because it is on-topic for this site. As far as I can tell the question is about generating noun phrases or prepositional phrases, so basically computational linguistics. May 22, 2019 at 11:37
  • The Maldives aren’t an island, but a large group of islands. And as is often the case when an island or archipelago is a sovereign state, there’s a lot of vacillation between ‘on’ and ‘in’ in languages like German. Also don’t forget there are languages where it’s the name, not the article, that changes; in Finnish, for instance, the Maldives are Malediivit, and ‘in the Maldives’ would be Malediiveilla (on) or Malediiveissa (in). I’ve left out ‘places’ here, since you also need to know which case that should be in. Apr 29, 2022 at 6:32
  • I think you need to do one language at a time. You can't just do them using all the same rules.
    – Lambie
    May 3, 2022 at 17:29

1 Answer 1

2

The article's presence or absence can easily be included as part of the substitution.  I don't have a solution for the when declension and/or change of pronoun is needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.