salesagility / SuiteCRM-Core

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
176 stars 123 forks source link

Extension language $mod_strings are not being recognized #45

Open iammatis opened 2 years ago

iammatis commented 2 years ago

Issue

Extension language $mod_strings are not being recognized. I am creating a custom simple extension, adding a button to Contacts/detail view.

Overriden detailviewdefs.php file (located in /public/legacy/custom/modules/Contacts/metadata/):

// in 'recordActions' array
'register-via-api' => [
    'key' => 'register-via-api'
    'labelKey' => 'LBL_REGISTER_VIA_API',
    'asyncProcess' => true,
    'modes' => ['detail']
],

Language file en_us.register_via_api.php (located in public/legacy/custom/Extension/modules/Contacts/Ext/Language/):

<?php

$mod_strings['LBL_REGISTER_VIA_API'] = 'Register via API';

More discussion on the official SuiteCRM forum.

Expected Behavior

For button to show up in Contacts/Detail view with the given label.

Actual Behavior

Button showed up but with no label, an empty string

Your Environment

pgorod commented 2 years ago

Is this just a matter of adding

global $mod_strings;

?

iammatis commented 2 years ago

I have not seen global $mod_strings; in any other language file, seems kinda wrong.

iammatis commented 2 years ago

I just realised, the labels for my custom action buttons are being displayed (they weren't before), but the ones for alerts/notifications are still blank. All of these label are in the same .lang.php file and they are all auto generated in the .ext.php file. When I replace one of the labels in $process->setMessages(['<label>']); with a predefined one it works, but it does not work with mine.

iammatis commented 2 years ago

Any progress on this or possibly other suggestions that could help ?

pgorod commented 9 months ago

Apologies for my comment 2 years ago, I wasn't seeing this issue correctly (thinking it was back-end).

Now I am! Actually, I am running into this issue myself :-(

Anybody know a way to fix?