public function output()
    {
        $output = $this->outputType();
        switch ($output) {
            case static::PROPERTY_DISPLAY:
                $type   = $this->displayType();
                $prop   = $this->display();
                $getter = 'displayId';
                $setter = 'setDisplayId';
                break;

            case static::PROPERTY_CONTROL:
                $type   = $this->inputType();
                $prop   = $this->input();
                $getter = 'inputId';
                $setter = 'setInputId';
                break;
        }

        $GLOBALS['widget_template'] = $type;

        if ($this->l10n() && $this->loopL10n()) {
            $locales  = $this->translator()->availableLocales();
            $outputId = $prop->{$getter}();
            foreach ($locales as $langCode) {
                // Set a unique property output ID for each locale.
                $prop->{$setter}($outputId.'_'.$langCode);
                $prop->setLang($langCode);

                yield $prop;
            }

            $GLOBALS['widget_template'] = '';
            $prop->{$setter}($outputId);
        } else {
            yield $prop;

            $GLOBALS['widget_template'] = '';
        }
    }