SharePoint 2013 Hosting :: Localize Content Type Names and Field Titles in Sharepoint Sandbox Solutions

In the event you operate with Sharepoint starting with pre-2013 version most probably you realize how to localize strings (content material sort names, field kinds, function names, net element titles, and so forth.) in farm solutions. As a way to do it we ought to use provisioning sources with special syntax: $Resources:resource file name without resx extension,string identifier, e.g. “$Resources:MyResource,Foo”. It assumes that specified resx file is provisioned with farm solution to 14 or 15/Resources folder (in VS resolution you could possibly develop mapped folder for that). But when we work with farm solutions situation is distinct: files will not be saved to the neighborhood file program. As a result of that we cannot use the exact same approach for localizing strings for different artifacts which are provisioned with sandbox remedy. Within this post I’ll show 1 approach which could be utilised for localizing content kinds names and fields titles which is most probably is most usually required requirement.

ahp banner sharepoint-01

To begin with I must say that tried several approaches ahead of located truly functioning approach. Also must say that this method makes use of codebehind which is as you almost certainly know is deprecated in sandbox solutions by MS. If it’s important for you to not use codebehind in sandbox options, you may rewrite the code e.g. through javascript client object model which and use the exact same concept for running it 1st time for provisioned internet site (see beneath). Also example under is shown for scenario when inside the exact same website collection there may be several different languages. Whenever you have single language per web site collection approach will likely be easier: as opposed to fixing content material types inheritors in all bound lists it will likely be enough to fix only site content material kind and propagate alterations to all lists which use this content sort.

Ok, lets verify the approach itself. Website columns (fields) and content material kinds are provisioned with hardcoded strings (I use English names, but you may use any language for default string values according to your language):

content type:

After we will provision these components to the Sharepoint website they will have names/titles that are hardcoded in xml shown above. Also in all lists exactly where this content material kind is bound to the exact same string values will likely be utilized. The subsequent step is always to run code that will localize these strings depending around the specified language.

As I already talked about above we will consider the scenario when there might be sub sites (SPWeb) on different languages inside the exact same internet site collection. In this case we will need to have reference around the list content material sort which inherits web site content material sort and update strings there. If we would update website content kind itself and would propagate modifications to all lists which use this content material kind, all sub websites would have titles around the same language which was final used that is of course not what we want.

Translated strings need to be stored in resx files that are embedded for your sandbox solution’s assembly. After you’ll add them to VS resolution you’ll also need to have to add additional assemblies to your package manifest (a single assembly per every single translation):

1weknvcolIn this example we added Finnish and Russian resources.

After that we are ready to make actual localization. Here is the sandbox code which will localize list content type and its fields:

It gets the reference towards the SPLIst (lines 3-8), then find required content material sort within the list (lines 13-15) and updates content kind name (lins 15-20) and all fields within the list which correspond to acceptable content material kind (lines 22-26) with strings from resource file for the language on the current internet site (line 10). Note that we get reference on fields collection from SPList.Fields, not from SPContentType.Fields or FieldLinks.

The remaining query is exactly where to put this code and in what moment it should be executed. I attempted to use WebProvisioned handler, however it didn’t operate: there had been no any errors, just changes were not applied towards the content material kinds and fields, and they remain with default English texts. The only working approach I located is usually to put hidden net portion with initialization code for the site’s front web page. After web site is designed user is redirected towards the front page of this web site. Within this moment we might execute necessary post initialization logic. We want to make sure that it will likely be executed once. Within the farm env it will likely be tricky to make sure that code is operating in single thread after, so I will omit these details right here:

As shown within this instance when internet part runs the code when, it will update house bag setting and will not run twice.

This post shows that although in sandbox answer basic operations like localization of content material varieties and fields are much more complicated they may be nonetheless possible and you could use it within your projects.

Top  SharePoint 2013 Hosting Recommendation provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. offers SharePoint 2013 hosting starts from $9,99/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable SharePoint 2013 Hosting, should be your best choice.

The price of SharePoint 2013 hosting packages is quite competitive, especially the Level 1 which we may recommend most here. The Level 1 hosting package is €9.99/mo. It include 50GB bandwidth, 5 GB disk storage, MSSQL 2012 databases, MySQL databases, Unlimited Subsites and support almost all of the cutting-edge Windows technologies, such as remote IIS management, ASP.NET v5 and Full Trust. Hosting a Windows-based website with should be absolutely worry-free. is Microsoft Gold Partner, which means they will be the first one to know the latest Microsoft technology and test Microsoft product before being released to the public. With tons of positive feedback from their customers, we are glad to grant them as the Best SharePoint 2013 Hosting of this month. Their SharePoint hosting is sold at $10/month only, each account is allocated with large Bandwith and Storage Space. It’s sufficient to run a website which is not very busy.