0

We are trying to globalize an application and we have run into a situation where I'm not sure how (of if) we would go about formatting the string for globalization. It's a paragraph explaining something with a list of names within it. For example:

"Bob, Sue and Michael each received a point."

"Bob, Sue and Michael" is the string in question and can be one to many people. What is the correct approach to translating the comma and "and" word?

closed as unclear what you're asking by gnat, Konrad Morawski, GlenH7, user40980, jwenting Sep 30 '14 at 7:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    The linguistically correct approach would be to use a globalization engine that can deal with the fact that different languages require the substituted elements to appear in different orders. Most engines can't, which is why commercial software usually uses workaround such as "The following players have received one point each:\nBob\nSue\nMichael\n". – Kilian Foth Sep 29 '14 at 13:13
  • 2
    ...that said, as a programmer, I can offer a completely unprofessional guess that you might want to learn about Oxford comma – gnat Sep 29 '14 at 13:15
  • 3
    @gnat This is absolutely not off topic. It's a perfectly legitimate question about best practices on localizing an application. – Crono Sep 29 '14 at 13:17
  • @Crono maybe, but it's more about linguistics than programming. – jwenting Sep 30 '14 at 7:11
  • 1
    How would you go about recommending I make the question more clear? Should I specify that I'm more interested in how to make the pattern work? It was meant to be more of a programming question... I think that the answer below along with Konrad's comment makes sense to me, but I want to make sure the question makes sense for others that may find value in the question/answer – Matthew Doyle Sep 30 '14 at 15:58
4

I'd say this is one of many localization scenarios where you'll have to admit a simple "key/language/value" storing pattern isn't enough. :)

I'd personally create a localization engine class with a method that'd take a list of words and a language as parameters. This method would build the "list" segment of your string. Once you have this, concatenate the result to the rest of your sentence and you'll have your complete, final string.

UPDATE:

Although IMHO this is a bit outside your question's scope, you might want to give some thoughts to Konrad's comment below. Depending on how many / which languages you have to support, it might be necessary for your localization engine to be in a higher layer of your app. It might have to know about the context and produce your complete string.

Not to say you cannot still process the "list" part at a lower level, though. But then it would likely be for a limited set of languages only.

  • Quite often you couldn't simply glue the result to the rest of the sentence. In some languages the rest of the sentence would also be affected by the contents of the list. This is actually OP's case, too - if his list only contained Bob, we wouldn't want the result to be "Bob each received a point". Anyway, in Polish it would be "Barbara i Asia otrzymały punkt", but "Roman i Asia otrzymali punkt". Note that the verb takes a different form, its conjugation suffix alternating between "ły" and "li" depending on whether there's a masculine noun on the list (a male name, in this case). – Konrad Morawski Sep 29 '14 at 14:41
  • There's a lot to think about here... I think what I implicitly was looking for on the answer to the question is "how difficult is it to do this" because there's only a handful of times this happens within our platform. In almost all circumstances, I'm localizing full sentences/keywords so I don't run into concatenation issues and may not have a need for a higher layer localization engine. – Matthew Doyle Sep 30 '14 at 16:00

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