Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extend felogin's locallang?

How is it possible to add translations of strings to the felogin plugin? I slowly start to get the convention for templates (directing to the modified templates in the plugin's typoscript configuration) but that does not work with the locallang. The original messages are in English in the xlf format, located in the plugin's folder. I know this can be done in TypoScript but I do not like to have the strings defined so incosistently. (I guess modifying that original file is not the proper way.)

like image 341
David Apltauer Avatar asked Jan 11 '23 03:01

David Apltauer


2 Answers

Overriding labels by TypoScript is the way to go. Manually editing the l10n files is a really bad idea - these files are overwritten on updating the translations. If the extension gets an update and new labels are added, you will want to perform the updates.

The change from XML files for translation to the XLIFF format didn't change anything in the best practise you should use for adjusting labels according to your needs. It's just another format with a standardized translation server (Pootle) that (in theory) allows some special features like e.g. plural forms.

Conclusion: Use TypoScript.

For the default language (no config.language set) use:

plugin.tx_felogin_pi1._LOCAL_LANG.default {
   key = value
}

For a specific language, e.g. German, use

plugin.tx_felogin_pi1._LOCAL_LANG.de {
   key = value
}
like image 168
lorenz Avatar answered Jan 31 '23 00:01

lorenz


The best way is to use the following code:

ext_tables.php, e.g. of your theme extension with

   $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:felogin/Resources/Private/Language/locallang.xlf'][] = 'EXT:theme/Resources/Private/Language/locallang_felogin.xlf';

and in this file you can use something like

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
    <file source-language="en" datatype="plaintext" original="messages" date="2015-06-30T21:14:27Z">
        <header>
            <description>Language labels for felogin</description>
        </header>
        <body>
            <trans-unit id="permalogin">
                <source>An diesem Rechner angemeldet bleiben</source>
            </trans-unit>
            <trans-unit id="ll_forgot_header">
                <source>Passwort vergessen?</source>
            </trans-unit>
            <trans-unit id="ll_welcome_header">
                <source>Sie betreten den Händlerbereich</source>
            </trans-unit>
            <trans-unit id="ll_welcome_message">
                <source>Bitte loggen Sie sich ein.</source>
            </trans-unit>
        </body>
    </file>
</xliff>
like image 29
Georg Ringer Avatar answered Jan 31 '23 01:01

Georg Ringer