This project is no longer maintained and no further public releases are planned.

No further support will be given.

Feel free to fork the git repository.

How to set up multi language forms

In the template file:

Specify markers for the multi language texts. The format of these markers is LLL:[key-in-language-file]. Check the documentation for further details for language markers.

Example:

<!-- ###TEMPLATE_FORM### begin -->
  <form name="form" method="post" action="###REL_URL###">
    <input type="hidden" name="submitted" value="1">
    <table>
      <tr>
        <td>###LLL:username###</td>
        <td><input type="text" name="username" value="###value_username###"></td>
      </tr>
      <tr>
        <td>###LLL:password###</td>
        <td><input type="password" name="password" value="###value_password###"></td>
      </tr>
      <tr>
        <td colspan=”2”><input type="submit" name="submit" value="###LLL:submit###"></td>
      </tr>
    </table>
  </form>
<!-- ###TEMPLATE_FORM### end -->

Your custom language file:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
  <meta type="array">
    <description>Language labels for my form</description>
  </meta>
  <data type="array">
    <languageKey index="default" type="array">
      <label index="username">Username:</label>
      <label index="password">Password:</label>
      <label index="submit">Login</label>
    </languageKey>
    <languageKey index="de" type="array">
      <label index="username">Benutzername:</label>
      <label index="password">Passwort:</label>
      <label index="submit">Anmelden</label>
    </languageKey>
  </data>
</T3locallang>

TypoScript:

You can specifiy the path to your translation file in any “langFile” associated with "formhandler".

Example:

plugin.Tx_Formhandler.settings.langFile = fileadmin/lang/myLangFile.xml

That was quite easy, right? But what about error messages?

To show error messages, you add error markers to your template and configure error checks in your TypoScript setup. For each error check you can add the according error message in the locallang file. Formhandler then chooses the right error messages in the current language.

Example:

<!-- ###TEMPLATE_FORM### begin -->
  ###ERROR###
  <form name="form" method="post" action="###REL_URL###">
    <input type="hidden" name="submitted" value="1">
    <table>
      <tr>
        <td>###error_username###</td>
        <td>###LLL:username###</td>
        <td><input type="text" name="username" value="###value_username###"></td>
      </tr>
      <tr>
        <td>###LLL:password###</td>
        <td><input type="password" name="password" value="###value_password###"></td>
      </tr>
      <tr>
        <td colspan=”2”><input type="submit" name="submit" value="###LLL:submit###"></td>
      </tr>
    </table>
  </form>
<!-- ###TEMPLATE_FORM### end -->
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
  <meta type="array">
    <description>Language labels for my form</description>
  </meta>
  <data type="array">
    <languageKey index="default" type="array">
      <label index="username">Username:</label>
      <label index="password">Password:</label>
      <label index="submit">Login</label>
 
      <label index="error_username_required">Please enter your username</label>
    </languageKey>
    <languageKey index="de" type="array">
      <label index="username">Benutzername:</label>
      <label index="password">Passwort:</label>
      <label index="submit">Anmelden</label>
 
      <label index="error_username_required">Bitte geben Sie Ihren Benutzernamen an</label>
    </languageKey>
  </data>
</T3locallang>

If the user doesn't fill out the username, the markers ###error_username### and ###ERROR### are filled with the content of the translation error_username_required. "required" is the name of the configured error check in TypoScript.


to top