opensource.google.com

Menu

qLabel: Multilingual content without translation

Tuesday, April 1, 2014

Today we are happy to release qLabel, an open source JavaScript library that looks up and displays the labels of entities marked-up in a Web site in the language of the user. You can use qLabel in any Web document - below are some examples of where it might come in handy.

Some web sites provide content in a very structured form - think of restaurant menus, schedules, images with textual annotations, catalogs, etc. For example, this is a map of the inhabited continents:
Providing this content in different languages is as easy as looking up how all the mentioned entities in the SVG map are named in the other language. If we want to display the content in German, we need to know that South America is Südamerika in German and replace it.
The same works for Chinese:

Or, to take a language that Google Translate does not support yet, such as Uzbek:

The labels that we have used so far are from Wikidata, a sister project of Wikipedia launched in 2012. Wikidata supports more than 300 languages, but there aren't labels for all entities in all languages yet. Let’s take a look at Hindi:
We see that the Hindi name for Australia is still missing. But adding that is as easy as going to the Hindi view of Wikidata for Australia and add the label, and likely by now someone has already fixed it (and that would be visible here if those images above would indeed be embedded SVGs instead of PNG files - see the live map demo). You can improve the content in Wikidata and make more knowledge accessible to everyone.

In these cases, there is no need for intelligent translation algorithms in order to translate the Website: it is enough to look up the label for the mentioned entities in the language of the reader and display them in place. qLabel does exactly that.

The Website author annotates the entities mentioned in the page with unique identifiers, and qLabel looks up the name for these entities in the language requested by the user and displays them. No need to wait until your translation service of choice supports your language, it only depends on the underlying lexicon of entities and the languages they support.

Every entity is marked up with a URI, which is then used to look up the labels in the requested language. Take a look at the examples: the above map, a tournament schedule, a food menu, and tour dates. You can use any URI that supports look-up using Linked Data standards, in particular Google’s Freebase and Wikidata, but you can also publish your own set of entities and labels as RDF or JSON-LD and use them — and at the same time releasing them to the Semantic Web!

Read more about qLabel and how you can use it. Contributions to the code base are more than welcome, the source code is on Github.  Let us know about how you use qLabel!

Thanks and kudos to rdfquery, Wikidata, any23, Freebase, Universal Language Selector, the Wiki Atlas, and the Wikidata Multilingual Picture Dictionary.

By Denny Vrandečić, Ontologist, Google Knowledge Graph 

.