20 votes

Multi Language tools

This control will add meta-data and a language switcher to your multi-lingual website. It will query the list of installed languages and return an unordered link list, a dropdown list or a set of flag images with links to translations of that 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 is ignored
  • This language switcher doesn't work for 1-1 multi-lingual site setup, only for multi 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 Document 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 examples and save it to a new file in the same directory so that it's not overwritten on updates. You can instantly start using it from the macro by just providing the file name without .cshtml as the parameter.
  • if you just changed your host-names, republish your whole site to prevent inconsisten 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">

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 sprites)
  • added a meta data macro that will tell search engines which language your page is in and were to find translations

1.1 15-9-2011

  • fixed a bug where 2 unpublished root language nodes would cause a failure.


Package owner

Yannick Smits

Yannick Smits

Yannick has 718 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 7.13.x, 7.12.x, 7.10.x, 7.6.x, 7.1.x

Package Information

  • Package owner: Yannick Smits
  • Created: 27/03/2011
  • Current version 1.1
  • License MIT
  • Downloads on Our: 5K

External resources