Jump to content

Usage of translateable strings (fe for label) problem on fields created via API from a module


Juergen
 Share

Recommended Posts

Hello @all

I want to know if someone stumbled over the same problem:

You have created a modul and during the installation process one or more fields will be created via the API. You have decided to use translateable strings for the field label, description etc. so it could be overwritten by translateable files.

$field = new Field();
  		$field->type = $this->modules->get("FieldtypeDatetime");
  		$field->name = 'mydate';
  		$field->label =  __('My Date');

So far so good. You install the module and everthing works fine. The label of the via API created FieldtypeDatetime is "My date".

Now you want to overwrite this and therefore you create the translation file and overwrite it with fe "Your date".

But then: Taking a look at the label of this inputfield on the edit form shows that the label has not changed. The reason for this behavior is, that the field was created before the translation file and therefore the overwritten label will not be used.

So you have to go to the field configuration itself and change the label there or you uninstall the module and install it once more. In this case the translation file exists if it was created before and can be used during the creation process of the inputfields.

It would be better if the overwritten value will be taken into account.

It is not really a problem, but does anybody also struggle with this and found a way to solve this behavior. If not it does not matter.

Best regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...