def METHOD_NAME(self, language, widget_name, plugin_name, force=False):
    self.init_locale(language)
    section = "manual-%s" % language
    mode = 'widget'if widget_name else 'plugin'
    name = widget_name if widget_name else plugin_name
    widgets = []
    if widget_name:
        template = os.path.join(self.root_dir, self.config.get(section, "widget-template"))
        if not os.path.exists(template):
            self.log.error("widget template '%s' language '%s' not found" % (widget_name, language))
            exit(1)
        for file in os.listdir(self.config.get("manual-en", "widgets-path")):
            if file.endswith(".js") and not file.startswith("Abstract"):
                # this is a widget
                found_widget = os.path.splitext(file)[0]
                if widget_name == "ALL" or widget_name.lower() == found_widget.lower():
                    widgets.append(found_widget)
    elif plugin_name:
        template = os.path.join(self.root_dir, self.config.get(section, "plugin-template"))
        if not os.path.exists(template):
            self.log.error("plugin template '%s' language '%s' not found" % (plugin_name, language))
            exit(1)
        plugin_dir = self.config.get("manual-en", "plugins-path")
        if plugin_name == 'ALL':
            widgets = [name for name in os.listdir(plugin_dir) if os.path.isdir(os.path.join(plugin_dir, name))]
        else:
            widgets = [name for name in os.listdir(plugin_dir)
                       if os.path.isdir(os.path.join(plugin_dir, name)) and name.lower() == plugin_name.lower()
                       ]
    if len(widgets) == 0:
        self.log.error("%s '%s' does not exist" % (mode, name))
        exit(1)
    if len(widgets) > 1:
        # do not allow forced overriding of multiple widgets, too dangerous
        force = False
    target_path = os.path.join(self.root_dir, self.config.get(section, "%ss" % mode))
    for widget_name in widgets:
        print("Generating doc source for '%s' %s in language '%s'" % (widget_name, mode, language))
        target = os.path.join(target_path, widget_name.lower(), "index.rst")
        if force is False and os.path.exists(target):
            self.log.error("%s documentation already exists for '%s' in language '%s'" % (mode, widget_name, language))
            continue
        headline = _("The %s widget") % widget_name if mode == 'widget' else _("The %s plugin") % widget_name
        headline_mark = u"=" * len(headline)
        headline += u"\n%s" % headline_mark
        headline = headline.encode('utf-8')
        with open(template, "r") as f:
            source = f.read()
            source = source.replace("%%%HEADLINE%%%", headline)
            source = source.replace("%%%WIDGET_NAME%%%", widget_name)
            source = source.replace("%%%WIDGET_NAME_LOWER%%%", widget_name.lower())
            if not os.path.exists(target):
                os.makedirs(os.path.dirname(target))
            with open(target, "w") as ft:
                ft.write(source)