Skip to content

Language support

Oleg Lavrovsky edited this page Jan 3, 2020 · 1 revision

If you would like to change the language with which results from the multilingual opendata.swiss portal are displayed, you need to set the endpoint URL with the language code, e.g.

  • 'https://opendata.swiss/de/'
  • 'https://opendata.swiss/fr/'
  • 'https://opendata.swiss/it/'
  • 'https://opendata.swiss/en/'

And also search parameters may need to be tweaked, e.g. the title_string_de sorting code changed to title_string_it, etc.

Have a look in this example from the way we have currently configured the Thurgau Datenkatalog, set to German (de):

function embedGroup(group) {
  ck.datasets('#ckanEmbed', 'https://opendata.swiss/de/', {
    fq:       'organization:kanton-thurgau groups:' + group,
    rows:     20,
    sort:     'title_string_de asc',
    noresult: 'Keine Daten gefunden',
    template: _.template(
      '<div class="ckan-dataset">' +
      '<a href="<%= ds.url %>" target="_blank">' +
      '<h4><%= ds.title %></h4>' +
      '</a>' +
      '<p><%= ck.truncate(ds.description, 250) %></p>' +
      '<small class="ckan-fmt"><%= ds.formats.toUpperCase() %></small><br>' +
      '<small class="ckan-fmt-nm"><%= ds.zeitliche_abdeckung %></small> ' +
      '</div>'
    )
  });
}
$('#ckanEmbed').each(function(e) { embedGroup($(this).attr('data-group')) });
Clone this wiki locally