Jump to content


  • We are moving our Documentation to our new Guides area.

    As articles are moved they will be deleted. Please start following the new guides. We look forward to publishing all our new guides soon!

  • Translatable Text Fields (*)

    Translatable text fields can be used to allow the user to provide a different value for all of the different languages they have on their community (if they have only one, they will appear to be a regular text field). They are commonly used for when an administrator has to provide the name for something which may need to be different depending on the language. They are not designed to be used outside of the ACP.

    To use translatable fields in your code, you use the \IPS\Helpers\Form\Translatable class within the Form Helper. Using a Translatable field is slightly more complicated than most other form types.


    Creating the element

    When creating the element you must provide an $options parameter specifying an application which "owns" the language string and a key. If you are displaying a "create" form for something which hasn't been created yet, you can pass NULL as the key.

    Unlike other fields, $defaultValue must be NULL. The system will automatically fill in the current value for the key.

    For example, the code to create your element will look something like:

    $form->add( new \IPS\Helpers\Form\Translatable( 'my_translatable_field', NULL, TRUE, array( 'app' => 'app' 'key' => 'my_language_string' ) ) );


    Handling Submissions

    You must save the returned value manually like so:
    \IPS\Lang::saveCustom( 'app', 'my_language_string', $values['my_translatable_field'] );


    Text area and editors


    You can make the field a texture rather than single-line textbook by setting the "textArea" element in $options to TRUE. To use a full WYSIWG editor, you must make all the normal considerations for an editor field. Then set the "editor" element in $options to what you would normally set as $options in the \IPS\Helpers\Form\Editor object.

    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy