InfoPath Trick to Localize a form in a single view

TRICK: Localized form in a single view

Applies to: Microsoft Office InfoPath 2003 SP1

Need the same form in many languages?  Here’s a trick that’s easier than multiple views.


By taking advantage of new SP1 features, there’s a simple way to create a multi-language view without duplicating bindings.

I have used a secondary data source with read-only borderless fields as labels for the view.  This secondary data source is populated by an XML File Data Connection that grabs a file in the LabelsLanguage form library.  This form lib populates a drop-dom, changes of this update the aux-dom and refresh the view.

There are 2 buttons for adding new languages and editing the current labels of the form.  These pop up a second solution.  To add a new language, just fill out the form and submit.  Look at one of the existing languages for examples.  If you see a typo in your language, feel free to correct it and save.

To work with button labels, manually update the view using xsl:value-of elements.  Otherwise, use the workaround that I have in the screenshot.

Known issues:

  • If you update a language on the fly, you need to force IE to always update the cache so you will get the drop-down changes.

  • Some flashing when changing the language.


Here’s a sample of what it might look like:

Picture with a language drop down selection 

Form Code

public void ChangeLanguage(DataDOMEvent e)

      if (e.IsUndoRedo) return;

      if (e.Operation.ToUpper() == "DELETE") return; //handle double notifications


      // Generate the new file name from the drop-down

      string strFileName = (string)e.NewValue; //from dropdown english.xml

      XMLFileAdapter2 xfaLabels = e.XDocument.DataAdapters["Labels"] as XMLFileAdapter2;

      string strCurrentUrl = xfaLabels.FileURL; //from adapter http://server/site/francais.xml

      string strBaseUrl = strCurrentUrl.Substring(0,strCurrentUrl.LastIndexOf("/")); // http://server/site

      string strCurrentFileName = strCurrentUrl.Substring(strCurrentUrl.LastIndexOf("/")); // francais.xml

      string strNewUrl = strBaseUrl + "/" + strFileName;          // http://server/site/english.xml

      xfaLabels.FileURL = strNewUrl;


      // the drop-down refreshes everything


      (e.XDocument.DataAdapters["Languages"] as SharepointListAdapter).Query();



public void AddLanguage(DocActionEvent e)


      string strLanguagesFormUrl = "http://your-forms-url/template.xsn";


      (e.XDocument.DataAdapters["Languages"] as SharepointListAdapter).Query();



public void EditLabels(DocActionEvent e)


      XMLFileAdapter2 xfaLabels = e.XDocument.DataAdapters["Labels"] as XMLFileAdapter2;

      thisApplication.XDocuments.Open(xfaLabels.FileURL, 1);     



Comments (4)
  1. Haaron Gonzalez says:

    Hi, i have a question, how can i program navigation capabilities through script. I have a button and i need to open a existing InfoPath file in preview mode. Thanks and hope you can help.

  2. Hi Haaron – we’ll use your question to help guide us for future postings. Until then, I really recommend you drop by our newsgroup to ask your question: newsgroup microsoft.public.infopath, URL – Thanks!

  3. Raja says:

    by any chance do you have a working example for localizing a form with single view. If so, can you please forward me the xsn at

  4. Check also this says:

    You can also check this :…/multilanguage-infopath-forms

Comments are closed.

Skip to main content