Adding translations on the flow
Hi,
I have a module which creates different categories. With version 3.8.8 i'm able to link all these categories to a specific page. I do this by:
BackendModel::insertExtra('block', 'Products', 'Category', $item['title'], array('id' => $item['id']));
But is there a option to add the label to the translations table? Because when I set the module for the page the text shown is {$lblPageCategory}
instead of the category name.
Thanks
I don't know if there's a core method to add translations to the database. If you install a module, you can import the translations but I don't know if you can add a single translation one at a time.
I think you'll have to create a mysql insert query in your module model.php and insert the values, something like the Locale/translations module in the backend does
And then insert a new translation into the database when your code creates a new category...
If I understand your question well it's done like this. you can add the extra_label in the serielized data field and that will be used.
you can take a look here for a codesample
Thanks, that worked. I found a similar function before but that didn't work.
This is the code what solved the problem (if somebody needs it), create:
$data = array(
'id' => $item['id'],
'extra_label' => $item['title']
);
$extraId = BackendModel::insertExtra('block', $this->getModule(), 'Category', $item['title'], $data);
And this is the code that I use to update the extra:
$data = array(
'id' => $item['id'],
'extra_label' => $item['title']
);
BackendModel::updateExtra($item['extra_id'], 'data', $data);