0

I found a few option on how to localize or provide a localized site column.

  1. PnP templates with resource files will provide the fields in the language but will not localize it when the site language is changed. At least this is the behavior I am getting. You can provide the column and the translation values, but the column title will be translated.
  2. TitleResource. I tried to set with JSOM but did not seemed to work.
  3. Manually switching the site language setting the Title of the column for each language you want to support. ref: https://manueltgomes.com/microsoft/translate-your-list-column-names/

So, so far the option 3 works well. But I need to make this process automatic. Anyone aware how to to this with scripting provisioning in mind?

And why I am not able to use the method setValueForUICulture to update the TitleResource? This does not seem to work anymore.

1 Answer 1

0

I was able to figure out what I was missing. FYI for anyone interested: instead of:

var ctx = new SP.ClientContext.get_current();
var field= ctx.get_web().get_fields().getByInternalNameOrTitle("testmultilang");
field.get_titleResource().setValueForUICulture("en-US", "Localize Site Column");
field.get_titleResource().setValueForUICulture("pt-PT", "Localize Site Column - Portuguese");
field.get_titleResource().setValueForUICulture("fr-FR", "Localize Site Column - French");
field.get_titleResource().setValueForUICulture("es-ES", "Localize Site Column - Spanish");
field.update();
ctx.load(field);
ctx.executeQueryAsync();

I had to do:

var ctx = new SP.ClientContext.get_current();
var field= ctx.get_web().get_fields().getByInternalNameOrTitle("testmultilang");
field.get_titleResource().setValueForUICulture("en-US", "Localize Site Column");
field.get_titleResource().setValueForUICulture("pt-PT", "Localize Site Column - Portuguese");
field.get_titleResource().setValueForUICulture("fr-FR", "Localize Site Column - French");
field.get_titleResource().setValueForUICulture("es-ES", "Localize Site Column - Spanish");
field.updateAndPushChanges(true);
field.update();
ctx.load(field);
ctx.executeQueryAsync();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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