Deleting all dictionary item from the umbraco dictionary

by Damiaan Peeters 21. December 2013 19:38

Sometimes you need to delete all dictionary items from the Umbraco dictionary. 

The problem

Deleting 100’s of dictionary items can be a PITA.  Imagine you have to right click for every dictionary item and select delete.


Side information

First you probably want to know which tables the dictionary is using.  There are 2: one for the items, one for the translations.  They call cmsDictionary and cmsLangaugeText. 

If you ever want to get information from the dictionary, just join these tables and you have what you need.

select,, d.[key], lt.languageId, l.languageISOCode, lt.value
from cmsDictionary d inner join cmsLanguageText lt on = lt.UniqueId
left join umbracoLanguage l on lt.languageId =
where = 6


The fastest way to remove all umbraco dictionary items is through SQL.  To remove ALL dictionary items, just run this SQL script:

delete from cmsLanguageText
delete from cmsDictionary

Don’t forget to touch the web.config because dictionary items are heavily cached!

Did you know this is default in Umbraco?

by Damiaan Peeters 8. December 2013 15:18

A few days ago I got the question from a manager: “Is this default in Umbraco?” To be honest, that is a very difficult question that deserves a blog post on it’s own.  So here it is!  The answer to a general question asked to an umbraco developer: "Is this default in Umbraco?"

Short answer

It is probably a default setup on how you can work with Umbraco.  So: yes.

Slightly longer answer

It depends of course on what you call “default”.  But the developer you are asking this question, has probably implemented the things asked already a few times.  Been there, done that.  And if he hasn’t done so, he might have found a blog post or forum topic which explains how to do so.  Or maybe he has found (a free) package, which does the things considered to be default.

The reason why the developer can say it is default, is packages, blogs and extending umbraco IS default.  Without the default behaviour, you would not have a website. 

Long answer

First of all, I wrote earlier that Umbraco is not a CMS, I called it a framework.  Umbraco provides a base for you to build web applications (or websites), without trying to interfere with the developers using it.

Umbraco does not provide strict guidelines on how to setup your website.  It does not force information into predefined concepts.  As such the developer need to (sic, by default) extend the Umbraco download, in order to have a website.  The nice thing about Umbraco, is that it doesn’t limit you in how you organise everything to get things done.  It gives you a solid base where you can plug in different things.

The core of Umbraco exists out of an amount of default modules.  These modules take care of rendering your webpages, building URL’s, saving and publishing content items (nodes) and rendering backend.  These modules are “default”, but no-one would not expect otherwise from a CMS.  That's why you are not writing your own rendering engine, but instead choose a CMS. 

A lot of modules in the Umbraco Core can be replaced or extended by your own needs.  I consider replacing these modules, or adding extra functionality to modules ALSO default.  A developer familiar with the concerned topics (extending umbraco and dev’s reference), doesn’t need to know all the internals to add easy customizations to your website.  This is were a lot of power of umbraco comes from, and is to my knowledge not always easy to do with other cms’s. Extending the base is daily job, and can be considered default.

If the core is not enough, there are a lot of packages.  Packages are pieces of software which are developed by 3th parties (except for Courier, Contour and Concierge), which add extra functionality to Umbraco.  Most packages are free, some not.  Packages are build for Umbraco, and the Umbraco back-end makes it very easy to install addons.  I think we can safely say that most Umbraco installations use packages.  This makes me believe the Umbraco Packages are default.  If someone would try too argue against, consider that there are packages which are now included (or parts of it) into to core (like uGoLive, uComponents, …).

One of the great side effects of having such a Robust core is that a lot of package creators, implement the same robust principles in there software.  This makes it for packages developers easy to plug into events of 3th party packages, and “customize” this further.

If you read up till here, you might wonder: all this customization sounds like pretty expensive.  I can’t talk for other companies, or what they are charging for certain functionality.  In our experience, Umbraco offers a lot of extendable default functionality speeding up development.  This gives the customizations in question a much higher return on investment, compared to Umbraco-less solutions.

So what do you think?  What do you consider "default" in umbraco?

Smart homepage switching on HTTP accept-language headers

by Damiaan Peeters 1. December 2013 10:18

Http Headers

Every time time a browser requests a webpage from a web server, there are headers added to the the request.  Information like: Give me page X, I accept HTTP, you can Gzip or deflate data, proxy information, …

On of these http headers are the “Accept-Language” http headers.  So what does these headers mean?

Each language-range MAY be given an associated quality value which represents an estimate of the user's preference for the languages specified by that range.

If you open your browser hit F12, you can find for every request the headers back.  The accept language headers can look like this:


This means: I prefer Dutch, but will accept US English or any English dialect if available.  Every user can change the browser settings to reflect their language preference.

Sometimes – from a user design perspective, using the http headers to show understandable content to the user might be a good idea.  A lot of UX experts argue pro and/or contra.  We won’t go into the discussion because this is mainly a technical blog.  Let’s just try to implement it, because we can!  Glimlach

The solution

I’ll be using the IContentFinder for the solution. Never heard of the ContentFinderResolver?  Then read my previous blogpost or some official umbraco documentation.

I think that this is one of the cases where you can use IContentFinder to control what Umbraco serves to the rendering process.  We need to start with adding a new entry to the ContentFinderResolver.  This time we want it to be launched before the default umbraco implementation.  We can do this by using the following code:

ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByNiceUrl, MyCustomHttpAcceptLanguageContentFinder>();

The rest of the idea is simple, for all root content nodes, search back the “Domain” object, and check whether the language matches.

try {
  string acceptLanguage = HttpContext.Current.Request.UserLanguages[0].Split('-')[0];
  string domainName = System.Web.HttpContext.Current.Request.Url.Host.ToLower();
  var rootDocs = UmbracoContext.Current.Application.Services.ContentService.GetRootContent();
  foreach (var rootDoc in rootDocs)
    var domains = Domain.GetDomainsById(rootDoc.Id);

    var domainmatch = domains.FirstOrDefault(domain => domain.Language.CultureAlias.StartsWith(acceptLanguage));
    if (domainmatch != null)
        contentRequest.PublishedContent = rootDoc;
} catch {
  // search engines don't send language-accept headers

Attention, this is a very basic implementation and not ready for production at all! 

The SEO Warning

Like mentioned in the code: take care when implementing a solution using accept-language.  Googlebot is NOT sending any accept language headers along.  So be sure that you don’t get trapped in sending empty pages or (500) errors to the Search Engines.

With that I would like to ask, do you consider this as a valid use of IContentFinder?  What other Content Finders do you have in mind?  Have you already used the ContentFinderResolver?

Certified Umbraco, .net and Azure developer, seo lover. Magician in my spare time.

Month List