Search code examples
cachingtypo3translateextbase

Translate Extbase Extension with locallang.xlf, but nothing happens?


I'm using TYPO3 CMS 6.2.6 and a new fantastic Extbase Extension called "jobfair". I've add my new templateRootPaths like this:

plugin.tx_jobfair {

  view {
        templateRootPaths {
          100 = EXT:jobfair/Resources/Private/Templates/
          101 = fileadmin/templates/ext/jobfair/Resources/Private/Templates/
        }

        partialRootPaths {
          100 = EXT:jobfair/Resources/Private/Partials/
          101 = fileadmin/templates/ext/jobfair/Resources/Private/Partials/
       }

       layoutRootPaths {
          100 = EXT:jobfair/Resources/Private/Layouts/
          101 = fileadmin/templates/ext/jobfair/Resources/Private/Layouts/
       }
  }

}
...

So I can edit the Templates and Partials for my specific Design. ALl other templates will load from /typo3conf/ext/jobfair/Resources/...

Everything works fine. I also copied the language-folder from the extension (typo3conf) to my fileadmn-folder (fileadmin/.../jobfair/Resources/Private/Language/).

I edit "locallang.xlf" and "de.locallang.xlf", for example:

partial: ContractType.html

<f:if condition="{job.contractType} == 0">
 <f:translate key="tx_jobfair_domain_model_job.contract_type.0" />
</f:if>

I'll change the target at de.locallang.xlf

<trans-unit id="tx_jobfair_domain_model_job.contract_type">
<source>Contract Type</source>
<target>Here's my german translation!!!</target>
</trans-unit>

But it isn't working!?

How can I translate or rename backend (flexform)labels for my ext.? Isn't the de.locallang.xlf the right file?

Thanks for your help. p.s. I cleared any cache in TYPO3 .. nothing happened.

Here is my filesystem

ext-folder copied in fileadmin

I use it the same way for my FLUIDTEMPLATE

fluid and language typo3


Solution

  • Template and language handling are independent components in TYPO3. Therefore the template files you overwrite the original with cannot "know" that you copied the language files somewhere else. You have several options.

    Just for the record, overriding labels for the frontend can be done comfortably using TypoScript:

    plugin.tx_yourext._LOCAL_LANG.[languageKey] {
        labelKey = New label text
    }
    

    (The default language has "default" als languageKey.)

    In the backend, you can override TCA and FlexForm labels using Page TSConfig:

    # TCA
    TCEFORM.tt_content.layout.label = New label
    
    # FlexForm field
    TCEFORM.tt_content.pi_flexform.[ext_key].[sheet_key].[field_key].label = New label
    
    # Example for Powermail
    TCEFORM.tt_content.pi_flexform.powermail_pi1 {
        main {
            settings\.flexform\.main\.optin.label = Require opt-in for mails
        }
    }
    

    Please mind the backslashes in the Powermail example. The according field is called settings.flexform.main.optin. Since dots are normally "path separators", they must be escaped to make it work.

    Besides from this configuration way, there's a completely different approach. You can override whole translation files:

    # Override XLF for default language
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['path/to/originalTranslationFile.xlf'][]
        = 'path/to/otherTranslationFile.xlf';
    # Override XLF for French language
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr']
        ['path/to/originalTranslationFile.xlf'][] = 'other/path/to/fr.otherTranslationFile.xlf';
    

    More information on this topic can be found here.