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?
8
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.
2