How to SharePoint?

Using “DetectedLanguage” to return only localized results from SharePoint Search index

This post was most recently updated on December 27th, 2018.

Reading Time: 4 minutes.

Localization and targeting of content in multilingual SharePoint installations is always an issue. SharePoint offers a multitude of ways profile content based on user language (or other properties), but none of the solutions are fool proof. This post describes how to fetch only localized results from SharePoint Search index, which solves at least some of the issues.


SharePoint Search index can be used in quite a few different ways. Probably the most typical way is by searching on SharePoint, or using webparts like Content Search or Content Results. However, one can also build custom functionality, custom client-side liftups, webjobs, single-page applications, mobile applications and a ton of other things that fetch data from SharePoint search index. However, on multilingual tenants, results are, by default, not localized at all. That means, that typically everyone will get the highest-ranking results back, despite them being in the wrong language. And that’s one of the many, many ways to annoy your users!

What does this mean in practice? If the organization has an active, Spanish-speaking unit or office, and they have very popular documents about things like “SharePoint”, or “Valo Intranet”, also the French-speaking employees will typically see these documents (in Spanish) when searching for “SharePoint” or “Valo Intranet”. That’s not always useful, is it?

Luckily, there’s a simple (even if only partial) solution!


SharePoint actually does language locale identification behind the curtains. It works a lot better than you’d expect, too! Which is to say it’s far from perfect, but still decent.

Testing the locale identification makes it obvious, that even if it isn’t flawless, it’s quite decent. See a couple of screenshots below! I did not think I had any Spanish content on the site, but apparently one of the icons uploaded is detected to have a Spanish name. 

DetectedLanguage ES
DetectedLanguage ES

That’s slightly funny, though – maybe SharePoint ignores accents and weird characters altogether? Google Translate just figures it’s a Turkish word… :)

Futboll - Google Translate autodetect
Futbol – Google Translate autodetect. Turkish? Eh, it’s probably that in Spanish, too :)

Anyway, how about content in Finnish on my site?

DetectedLanguage FI
DetectedLanguage FI – yeah, it seems about right!

Oh yeah, there’s a lot of stuff. Just a few of the first results here – and it definitely works! I’m clearly getting back localized results from SharePoint Search service.

But that’s certainly not all there is to it! Since DetectedLanguage is a Managed Property, you can use it in different search-based content rollups. See below:

Using DetectedLanguage in SharePoint Query Builder
Using DetectedLanguage in SharePoint Query Builder
SharePoint Enterprise Search Center language refiner
SharePoint Enterprise Search Center language refiner.. Yep, it’s there!

You probably realized this already, but this is actually just a nice way to access the same language information that you can use to filter search results on the good old SharePoint Enterprise Search Center, as a refiner. SharePoint automatically recognizes and tags the content’s language.

However, what’s the extra value, then? This isn’t that automatic, is it – you have an option to filter content by language, but it still doesn’t really automatically give users content in their own language, right? True – but you can actually automate this a bit! 

Advanced use case – use the user’s language!

Now, how to combine this with user profile properties to make the filtering dynamic? You can use SharePoint’s User Profile Service’s properties for this!

For example, for matching a documents “Department” field to user’s Department -property (using Managed Properties), you can do this:


In general, these properties work like this:

{User.<name of the property>}

(For more information about how to use the profile properties, check out this great blog post by Benjamin Niaulin!)

SharePoint User Profile Service property indexed true
SharePoint User Profile Service property indexed true

However, by default SharePoint doesn’t crawl language properties from your user profiles. You’ll have to either change a property to be indexed, or add a new one. 

So, in short, combined with DetectedLanguage this would be something like this:


… in which “LanguageCode” would be a property you’ve created to contain a 2-letter language code, such as “en” or “fi”.

Well then, I guess that’s about it! DetectedLanguage is quite flexible and super useful, so make sure to try it out! :)


Nick Grattan has an awesome blog post about this.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments