public function getLocalizedFormField($fieldName, $locale)
    {
        $baseName = $this->getBasename($fieldName);
        $fieldLabels = $this->owner->fieldLabels();
        $localizedFieldName = self::localized_field($fieldName, $locale);
        $fieldLabel = isset($fieldLabels[$baseName]) ? $fieldLabels[$baseName] : $baseName;

        if (!$this->canTranslate(null, $locale)) {
            // if not allowed to translate, return the field as Readonly
            return ReadonlyField::create($localizedFieldName, $fieldLabel);
        }

        $dbFields = array();
        Config::inst()->get($this->owner->class, 'db', Config::EXCLUDE_EXTRA_SOURCES, $dbFields);

        $type = isset($dbFields[$baseName]) ? $dbFields[$baseName] : '';
        $typeClean = (($p = strpos($type, '(')) !== false) ? substr($type, 0, $p) : $type;

        switch (strtolower($typeClean)) {
            case 'varchar':
            case 'htmlvarchar':
                $field = TextField::create($localizedFieldName, $fieldLabel);
                break;
            case 'text':
                $field = TextareaField::create($localizedFieldName, $fieldLabel);
                break;
            case 'htmltext':
            default:
                $field = HtmlEditorField::create($localizedFieldName, $fieldLabel);
                break;
        }

        return $field;
    }