Multi-lingual possessive case
-
Hi Not sure if this is the right forum for this as its more of a general question, but it didnt seem to fit any other category, and since I am looking for a c# solution.... I am looking for ideas to handle possessive case for a multi-lingual site. e.g John Smith's photo's (the 's after smith). Since the name is what the user entered, and in this case IN ENGLISH it requires an 's to make it possessive, but in some cases it will just require an apostrophe, without the (s). Doing this for a single language is easy enough when you know the rules, but how would you implement this on a site using Localization? Is there a better way than hard-coding the language rules per culture code? Thanks
-
Hi Not sure if this is the right forum for this as its more of a general question, but it didnt seem to fit any other category, and since I am looking for a c# solution.... I am looking for ideas to handle possessive case for a multi-lingual site. e.g John Smith's photo's (the 's after smith). Since the name is what the user entered, and in this case IN ENGLISH it requires an 's to make it possessive, but in some cases it will just require an apostrophe, without the (s). Doing this for a single language is easy enough when you know the rules, but how would you implement this on a site using Localization? Is there a better way than hard-coding the language rules per culture code? Thanks
I don't think you can do that a generic solution. In English it's easy, but in Polish you would have something like this: The name: "Jan Kowalski". Possessive case: "Jana Kowalskiego". You see, in Polish we have 7 (seven) cases. And those are applied to both first name and last name. Similar situation also applies to Russian, Czech and other Slavic languages. Don't know many others, but generally, you can't create generic solution for all languages.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
-
I don't think you can do that a generic solution. In English it's easy, but in Polish you would have something like this: The name: "Jan Kowalski". Possessive case: "Jana Kowalskiego". You see, in Polish we have 7 (seven) cases. And those are applied to both first name and last name. Similar situation also applies to Russian, Czech and other Slavic languages. Don't know many others, but generally, you can't create generic solution for all languages.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
Thanks, I figured that would be the case. I was just wondering if there was a better way than a whole bunch of "ifs" for each language we implement.
-
Thanks, I figured that would be the case. I was just wondering if there was a better way than a whole bunch of "ifs" for each language we implement.
Well... Another way could be to do with String.Format.
// retrieve formattingString from resource string.Format(formattingString, "John Smith");
And now for English you can have resource: "{0}'s photos". For Polish you could have: "Zdjęcia należące do użytkownika {0}". And although it is quite long, it is grammatically valid. But you have to create a version for each language you support :-)Don't forget to rate answer, that helped you. It will allow other people find their answers faster.