README

You might also like

You are on page 1of 1

This control will add meta-data and a language switcher to your multi-lingual we

bsite. It will query the list of installed languages and return an unordered lin
k list, a dropdown list or a set of flag images with links to translations of th
at page. It does this by querying the relationship API in umbraco.
When no relationship is found it renders the root url for that language
When the language is installed but not associated with a hostname the language i
s ignored
This language switcher doesn't work for 1-1 multi-lingual site setup, only for m
ulti node setup.
This control only works with unique hostnames. Haven't tested the scenario where
you have different languages on subdirectories (sub-domains work though).
The package includes CopyDocumentToRelatedOnPublish.cs in /app_code. This Docume
nt OnPublish event handler will automatically create a copy of the new Document
to all other language nodes and relates them. Remove it from app_code if you don
't want this functionality.
The Metadata macro renders this kind of meta data:
<meta http-equiv="content-language" content="dk" />
<link rel="alternate" hreflang="en" href="http://site.com" />
If you want the language switcher to reflect your exact HTML modify one of the e
xamples and save it to a new file in the same directory so that it's not overwri
tten on updates. You can instantly start using it from the macro by just providi
ng the file name without .cshtml as the parameter.
if you just changed your host-names, republish your whole site to prevent incons
isten results.
Future ideas for multi-language tools to add to this project:
new page creation workflows (including notifying translators)
notify translators (with a diff) about text changes in the "master" language
How to use
insert one or both macro's in your master template or
use the razor scripts directly in this notation:
<umbraco:Macro Language="cshtml" runat="server">
@RenderPage("~/macroscripts/MultiLanguage/LanguageSwitcher/List.cshtml")
</umbraco:Macro>
Version history
0.9 - 27-3-2011
initial release
0.91 29-3-2011
refactored code
added CopyDocumentToRelatedOnPublish.cs
1.0 1-4-2011
created complete package (not just razor files)
added different render views for language switcher. You can now choose between a
dropdownlist, a link list and country flags (either using separate images or sp
rites)
added a meta data macro that will tell search engines which language your page i
s in and were to find translations

You might also like