Skip to content

Plugin multilang_resources

Tobia Di Pisa edited this page Jun 4, 2018 · 6 revisions

Purpose of plugin

multilang_resources plugin provides per-language resources functionality. It allows to specify for which UI language resource will be shown.

Typical use case is when a dataset have resources which contain the same data, but are translated for several languages and each language has separate file. In regular CKAN installation, dataset would have long list of resources visible for any user:

 Resource - english.doc
 Resource - italian.doc
 Resource - french.doc
 ..

Multilang resources plugin allows to short down that list for user and display resources that are valid only for user's UI language, so user using English language will see only Resource - english.doc, user with Italian will see only Resource - italian.doc and so on...

Configuration

To enable this plugin you need to change config .ini:

  1. add it to ckan.plugins list, after multilang plugin:
ckan.plugins = .. multilang multilang_resources
  1. set 'ckanext.multilang.localized_resources' to true
ckanext.multilang.localized_resources = true

Note This plugin implements IDatasetForm interface, meaning it can't be used with any other plugin that implements this interface. One exception here is dcatapit_pkg plugin, which can be used along with multilang_resources. In this case, dcatapit extension takes over implementation of interface reusing methods from multilang_resources plugin.

Available languages

Plugin will use languages defined in CKAN deployment, and use available locales.

Usage

After enabling plugin, in resource edit form you can specify for which language resource should be displayed by selecting it from Language dropdown:

image

Resources which will have language specified will be shown for selected languages only. Resources which don't have language specified (or All languages was selected), will be displayed for all users, independently from the language selected in UI.

Clone this wiki locally