Language plugin

Plugin for Django CMS QE providing language switcher. It allows to add links for changing language of current page by changing URL.

Usage

Add plugin from section Generic called Language Switcher.

API

class cms_qe_i18n.cms_plugins.LanguageSwitcherPlugin(model=None, admin_site=None)[source]

CMS plugin allowing to add dynamically configured listing of any model.

form

alias of django.forms.widgets.LanguageSwitcherPluginForm

render(context: dict, instance, placeholder) → dict[source]

This method returns the context to be used to render the template specified in render_template.

Parameters:
  • context (dict) – The context with which the page is rendered.
  • instance (cms.models.pluginmodel.CMSPlugin instance) – The instance of your plugin that is rendered.
  • placeholder (str) – The name of the placeholder that is rendered.
Return type:

dict or django.template.Context

This method must return a dictionary or an instance of django.template.Context, which will be used as context to render the plugin template.

By default, this method will add instance and placeholder to the context, which means for simple plugins, there is no need to overwrite this method.

If you overwrite this method it’s recommended to always populate the context with default values by calling the render method of the super class:

def render(self, context, instance, placeholder):
    context = super().render(context, instance, placeholder)
    ...
    return context