In SharePoint 2010 you can access a site using different languages. Recently I had to synchronize list data with an external system, using the list field display names. Since the display name changed with the language, I had to make sure that the external system got the data in a specific language.
It is in fact quite easy to get the display name of the fields in a specific language, regardless of which language the current user has elected. All it really takes is the following line:
string languageSpecificDisplayName =
myField.TitleResource.GetValueForUICulture(new CultureInfo(myLCID))
In the above code I just had to give a specific language identifier (the myLCID), and SharePoint returned the display name in the language I needed.
The language identifier could be hard-coded, or stored in a property bag, a list, or perhaps in the external system.
No comments:
Post a Comment