Joomla Language string missing #596

Closed
opened 2020-09-04 06:50:03 +00:00 by duetnet · 2 comments
duetnet commented 2020-09-04 06:50:03 +00:00 (Migrated from github.com)

Steps to reproduce the issue

I have placed coding in adminview "JCBGUI.admin_view.php_before_publish" section to test certain criteria to make sure that publish is allowed, if not I generate error message and return false before record is updated.
Eg. here I generate error message and return false...
$msg1 = JText::('COM_MYTEST_CANNOT_PUBLISH_RECORD');
$msg2 = JText::
('COM_MYTEST_THE_LINKED_RECORD_NO_LONGER_EXISTS_PLEASE_DELETE_THIS_RECORD_AND_RECREATE_IT');
JFactory::getApplication()->enqueueMessage($msg1 . ‘ ‘ . $id . ‘. ’ . $msg2, 'error');
return false;

Expected result

If I Try to publish record, this should happen:
"Error
Cannot publish record 6. The linked record no longer exists. Please delete this record and re-Create it!!"

Actual result

I get joomla standard message also...
"Error
Cannot publish record 6. The linked record no longer exists. Please delete this record and re-Create it!!
COM_MYTEST_MYVIEWNAME_N_ITEMS_FAILED_PUBLISHING"

System information

  • OS Name & Version: win10
  • MySql Version: 5.5.5-10.4.13-MariaDB
  • Apache Version: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.8
  • PHP Version: 7.4.8
  • Joomla Version: Joomla! 3.9.21 Stable [ Amani ] 25-August-2020 15:00 GMT
  • JCB Version: 2.11.4
  • Browser: Firefox 80.0 (64-bit) (Also happens on Chrome and Edge)

Additional comments

On reviewing Joomla code in ‘libraries/source/mvc/controller/admincontroller.php
Lines 202-5 in function publish shows the following:
if ($errors)
{
\JFactory::getApplication()->enqueueMessage(\JText::plural($this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING', count($cid)), 'error');
}
However, JCB does not appear to generate a language string for ‘COM_MYTEST_MYVIEWNAME_N_ITEMS_FAILED_PUBLISHING’ in the file “en-GB_com_mytest.ini”.

I am not clear as to how I get JCB (or how to make coding changes) to actually generate the PHP language string necessary for the joomla message to be displayed correctly. Do I have to manually had the required string to the INI file for each view where I perform such a test??

Please advise..

### Steps to reproduce the issue I have placed coding in adminview "JCBGUI.admin_view.php_before_publish" section to test certain criteria to make sure that publish is allowed, if not I generate error message and return false before record is updated. Eg. here I generate error message and return false... $msg1 = JText::_('COM_MYTEST_CANNOT_PUBLISH_RECORD'); $msg2 = JText::_('COM_MYTEST_THE_LINKED_RECORD_NO_LONGER_EXISTS_PLEASE_DELETE_THIS_RECORD_AND_RECREATE_IT'); JFactory::getApplication()->enqueueMessage($msg1 . ‘ ‘ . $id . ‘. ’ . $msg2, 'error'); return false; ### Expected result If I Try to publish record, this should happen: "Error Cannot publish record 6. The linked record no longer exists. Please delete this record and re-Create it!!" ### Actual result I get joomla standard message also... "Error Cannot publish record 6. The linked record no longer exists. Please delete this record and re-Create it!! COM_MYTEST_MYVIEWNAME_N_ITEMS_FAILED_PUBLISHING" ### System information - OS Name & Version: win10 - MySql Version: 5.5.5-10.4.13-MariaDB - Apache Version: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.8 - PHP Version: 7.4.8 - Joomla Version: Joomla! 3.9.21 Stable [ Amani ] 25-August-2020 15:00 GMT - JCB Version: 2.11.4 - Browser: Firefox 80.0 (64-bit) (Also happens on Chrome and Edge) ### Additional comments On reviewing Joomla code in ‘libraries/source/mvc/controller/admincontroller.php Lines 202-5 in function publish shows the following: if ($errors) { \JFactory::getApplication()->enqueueMessage(\JText::plural($this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING', count($cid)), 'error'); } However, JCB does not appear to generate a language string for ‘COM_MYTEST_MYVIEWNAME_N_ITEMS_FAILED_PUBLISHING’ in the file “en-GB_com_mytest.ini”. I am not clear as to how I get JCB (or how to make coding changes) to actually generate the PHP language string necessary for the joomla message to be displayed correctly. Do I have to manually had the required string to the INI file for each view where I perform such a test?? Please advise..

The languages strings are build for you of course, but there are some system strings, and there are strings build for each view, field and where ever JCB gets the JText::_(

So JCB does not target JText::plural( in the code, but it does add these language strings. Here is where JCB adds internal language strings (there is a few function here doing internal strings), and just that you know it has been requested that I move these into the GUI so it could be changed or adapted per/view.

Does seem like FAILED Publishing is not added, here is where publishing is added. There is also items related strings added here, but I also do not see the FAILED option. As you can see the setLangContent( function is the function to follow all over the compiler, to see what is done, where and when.

I am willing to add it in, just not sure where, so do some tests and let me know.

The languages strings are build for you of course, but there are some system strings, and there are strings build for each view, field and where ever JCB gets the `JText::_(` So JCB does not target `JText::plural(` in the code, but it does add these language strings. [Here is where](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L10411) JCB adds internal language strings (there is a few function here doing internal strings), and just that you know it has been requested that I move these into the GUI so it could be changed or adapted per/view. Does seem like FAILED Publishing is not added, [here is where publishing](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L10486) is added. There is also items related strings [added here](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/c_Fields.php#L455), but I also do not see the FAILED option. As you can see the `setLangContent(` function is the function to follow all over the compiler, to see what is done, where and when. I am willing to add it in, just not sure where, so do some tests and let me know.
duetnet commented 2020-09-08 05:47:51 +00:00 (Migrated from github.com)

Thanks for feedback Llewellyn

I inserted the following code into the last link you provide, (i.e. file c_field.php, function setfieldset, at line 487) and message is now displayed correctly.

$this->setLangContent($this->lang, $langViews . '_N_ITEMS_FAILED_PUBLISHING', "%s " . $view['settings']->name_list . " failed publishing." );
$this->setLangContent($this->lang, $langViews . '_N_ITEMS_FAILED_PUBLISHING_1', "%s " . $view['settings']->name_single . " failed publishing." );

Thanks for feedback Llewellyn I inserted the following code into the last link you provide, (i.e. file c_field.php, function setfieldset, at line 487) and message is now displayed correctly. $this->setLangContent($this->lang, $langViews . '_N_ITEMS_FAILED_PUBLISHING', "%s " . $view['settings']->name_list . " failed publishing." ); $this->setLangContent($this->lang, $langViews . '_N_ITEMS_FAILED_PUBLISHING_1', "%s " . $view['settings']->name_single . " failed publishing." );
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#596
No description provided.