When you declare a SPField in CAML, you can add the localization in the code:

  Group="MyProject Columns"

However, some of the fields have to be created in code (e.g. External Data Columns). For these I also want localization. I found this solution, but I wonder if there's a cleaner way to do this.

2 Answers 2


You can add fields programmatically using list.Fields.AddFieldAsXml, providing CAML field definition with resource tokens in it.

Or you can wrap SetValueForUICulture in a nice helper method, and gain a capability to use it for any SPUserResource object. We're using this approach at work, and I would not say, that it is unclear or smth like this :) It's ok, just wrap it.

  • I tried with the AddFieldAsXml. The field takes the localization on list creation, however when changing language, it doesn't change (all other fields do).
    – Bart
    Commented Oct 13, 2011 at 15:08
  • Yep, a harsh detail. Haven't known about this. But what I do know undoubtedly, is that SetValueForUICulture will work properly with on-fly localization. Commented Oct 13, 2011 at 19:50

Have a look at SPUtility.GetLocalizedString()

  • I still got to push the localized string in some property, since I want the localization to change when the user changes his language in the browser, not only on provisioning.
    – Bart
    Commented Oct 13, 2011 at 7:23
  • Gotcha. Go for omlin's answer.
    – James Love
    Commented Oct 13, 2011 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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