1
votes

I am just starting to add support for multiple languages on my site... having a spot of trouble. Here are the steps I've taken so far:

  1. In Control Panel -> Globalization, added a new language (German)

  2. Added a new <site> definition in Web.config with hostName="localGerman.com" and language="de". Also added an alias in my hosts file for localgerman.com to point to localhost and added the host header in IIS.

  3. Went to an item in my tree and added a new version for German. Published whole site.

Now, the host/site setup seems to work OK. When to go to http://localgerman.com/ I get my home page, with lots of missing data... there is no German version... so seems to be using the correct language.

However... when I go to the item I've added a German version of, I still get blank data. In the debugger, I can see that Sitecore.Context.Item is the German version... but all the fields are blank. Item["Content"] returns an empty string. If I manually set the language to "en" on the URL (http://localgerman.com/myitem.aspx?sc_lang=en), then I get the English version with data.

What am I missing here?

Also... when loading the German home page... my menu is blank. Presumably because the items which generate this content do not have German versions. I was under the assumption that when a language-specific version for a given item could not be loaded, then the default language version is used? But this does not seem to be the case. Am I wrong?

2
I'm not sure about it, but have you published incrementally? Such a change might require at least smart publishing. Just a thought...Yan Sklyarenko

2 Answers

4
votes

OK, looks like I just had the language code wrong. Setting the site language to "de-DE" instead of just "de" worked.

This is a little confusing because the default sites use language="en" instead of en-US.

0
votes

You added a German version of an item, but did you fill in the fields in German ? Any localizable fields (non-shared) will be empty by default when a new version is created. It sounds like you did the other parts correctly.

The menu being blank is expected: When you try to get an language version of an item that doesn't exist, Sitecore will return null.