I want to change the DisplayName of a column in a content Type by API. It should work with the DisplayName defined in a resource file. The DisplayNames are defined in the LzTypeVPS.resx and LzTypeVPS.de-DE.resx file. The default language is English, the second language german.
I tried the following code.
var lzCtVPS_SEMId = new SPContentTypeId("0x010078a8230787d64c89852afa2751db1ee7010205");
var lzCtVPS_SEM = site.RootWeb.ContentTypes[lzCtVPS_SEMId];
lzCtVPS_SEM.FieldLinks["SNR"].DisplayName = "$Resources:LzTypeVPS,LzSEMSNr";
lzCtVPS_SEM.Update(true);This does not work. Regardless of the UI language when I activate the feature, the Displayname is always in the default (English) language when I change UI language later.
Next try
foreach (CultureInfo culture in site.RootWeb.SupportedUICultures)
{
Thread.CurrentThread.CurrentUICulture = culture;
String localizedString = SPUtility.GetLocalizedString("$Resources:LzSEMSNr", "LzTypeVPS", (uint)culture.LCID); ;
lzCtVPS_SEM.FieldLinks["SNR"].DisplayName = localizedString;
lzCtVPS_SEM.Update(true);
}This iterates through all supported languages of the site (with is english and german). The localizedString is extracted correctly from the resource and assigned to the displayname. But the last language "wins". This is de-DE. So now the DisplayName is in german, regardless of the choosen UI language.
So is there any chance to chance the DisplayName of a column within a content type and use resource files for different languages?
Greetings, Jörg