Typo3记录本地化

时间:2015-02-22 15:51:49

标签: image localization typo3 typoscript

我正在与Typo3 / Typoscript挣扎。 我想将网站本地化为两种语言(默认为德语,英语)。使用以下typoscript我可以本地化我的标准文本记录:

lib.main = CONTENT

lib.main {
    table = tt_content
    select {
        pidInList = this
        languageField = sys_language_uid
        orderBy = sorting 
  }

  renderObj.stdWrap.dataWrap = <section id="tt_content_{field:uid}"><article>|<hr class="clearer"/></article></section>

}

但是,没有图像/媒体记录及其字幕被覆盖/本地化。我的Typoscript中已经有了这些设置:

config.sys_language_overlay = 1
config.sys_language_softExclude = tt_content:image
config.sys_language_softMergeIfNotBlank = tt_content:image

config.sys_language_mode = strict

图像(和文件)和标题仍然是默认德语;没有翻译/本地化。即使我使用不同的文件更改了本地化记录,也只能看到默认值。还有另外一点我可以强制本地化吗?使用该图像的另一个片段是一个标题换行(另一个创建):

plugin.tx_presets_pi1 {

  rendering {
  file.import.data = file:current:uid_local

    caption {
      wrap = <p class="center image-caption">|</p>
    }
  }
}

有人可以提出解决方案吗? 我觉得这是一个FAL问题(和一个报告的错误......?!)感谢您的慷慨帮助:))

2 个答案:

答案 0 :(得分:2)

本地化文件或图片引用:上述解决方案的一个简单示例:

lib.image < styles.content.get
lib.image {

    renderObj = FILES
    renderObj {
        references {
            table = tt_content
            uid.data = field:uid
            fieldName = image
        }

        renderObj = IMAGE
        renderObj {
            file.import.data = file:current:publicUrl
            altText.data = file:current:alternative
            titleText.data = file:current:title
        }
    }
}

[globalVar = GP:L > 0]
    # Reference to localized image (including localized title and alternative)
    lib.image.renderObj.references {
        uid.data = 
        l18n_parent.data = field:uid
    }
[global]

答案 1 :(得分:0)

我有一个类似的问题:一个(视差)背景图像,里面有一个文本框。文本框的内容从图像标题,描述,替代文本和链接呈现。

诀窍是: 如果语言是&gt;使用l18n_parent而不是uid来关联图像引用关系。 0 [globalVar = GP:L&gt; 0]。所以你得到了图像的本地化。 这也很容易适用于滑块。

# Image with title, alternative text, description and link, replace 101 with your colPos
lib.bgImageWithTextbox < styles.content.get
lib.bgImageWithTextbox {

    select.where = colPos = 101
    stdWrap.required = 1

    renderObj = FILES
    renderObj {
        references {
            table = tt_content
            uid.data = field:uid
            fieldName = image
        }

        renderObj = COA
        renderObj {

            # Render container with image as background
            10 = IMG_RESOURCE
            10 {
                file.import.data = file:current:publicUrl
                file.treatIdAsReference = 1
                stdWrap.wrap >
                stdWrap.dataWrap (
                    <div class="g-section-padding-medium js-parallax" data-image-src="/|" data-speed="0.75">
                        <div class="c-box-background-image">
                            <h3>{file:current:title}</h3>
                            <p>{file:current:description}</p>
                )
            }
            # Render textbox with typolink (internal, external, target = _blank etc.)
            20 = TEXT
            20 {
                data = file:current:alternative
                typolink.parameter.data = file:current:link
                typolink.wrap = |
            }

            # Close image container
            30 = TEXT
            30.value (
                    </div>
                </div>
            )
        }
    }
}

[globalVar = GP:L > 0]
    # Translation of image texts
    lib.bgImageWithTextbox.renderObj.references {
        uid.data = 
        l18n_parent.data = field:uid
    }
[global]