My Apps on the SharePoint Store

My Books

  • Apps
  • Azure
  • REST
  • CSOM/JSOM
  • Service Apps
  • WCF
  • REST/OData
  • CSOM/JSOM
  • SharePoint API
  • Silverlight
  • jQuery

Recent blog posts

User login

Home | Blogs | Stephane Eyskens's blog

Tip with localized InfoPath web browser-enabled forms

Hi,

One technique to localize InfoPath forms is explained on MSDN at the following address. Basically, the idea is to embed your resx files into the form, associate a default one with a XML data connection and then, dynamically load the right resx file corresponding to the current locale of your SharePoint site.

However, what this article doesn't mention and what I couldn't find anywhere is that there is a small trap when using this technique. Indeed, if you do as specified in the article, you'll be facing a silly error and switching from one language to another will just not work.

It will work from the InfoPath Designer previewer but not from Forms Services (once published to SharePoint). This problem is because the path determined by the FileLocation property is not the same...In InfoPath Designer, it contains only the name of your resx file, say myfile.en-US.resx while in Forms Services, this path is prefixed by x-soln:///...

Therefore, in your code, say the loading event, you'd better add this check and adjust the path accordingly:

if (Application.Environment.IsBrowser)
                    ResxFilePath = "x-soln:///";

dc.FileLocation = string.Concat(ResxFilePath,"your file","the dynamic locale",".resx");
dc.Execute();



Happy Coding!