• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Using Text:: in Layout without success

Using Text:: in Layout without success 3 weeks 6 days ago #43885

  • pwickert
  • pwickert's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Thank you received: 2
Hello,

I have created a tabbed form. My site is bilingual, and the tabs need to be translated depending on the site language visited.

So I begin with this:

<!-- Do not remove this ID, it is used to identify the page so that the pagination script can work correctly -->
<div class="formContainer" id="rsform_{global:formid}_page_0">
<ul class="nav nav-tabs" id="formTabs">
<li class="active"><a href="#tab1" data-toggle="tab">Your name</a></li>
<li><a href="#tab2" data-toggle="tab">Education Echoes</a></li>
<li><a href="#tab3" data-toggle="tab">Paws and Pixels</a></li>
<li><a href="#tab4" data-toggle="tab">TLSS Pop Culture</a></li>
<li><a href="#tab5" data-toggle="tab">Team Updates</a></li>
<li><a href="#tab6" data-toggle="tab">Shout Out Corner!</a></li>
<li><a href="#tab7" data-toggle="tab">Suggestions</a></li>
</ul>

And after creating all the Joomla language overrides I have changed it for this:

<!-- Do not remove this ID, it is used to identify the page so that the pagination script can work correctly -->
<div class="formContainer" id="rsform_{global:formid}_page_0">
<ul class="nav nav-tabs" id="formTabs">
<li class="active"><a href="#tab1" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_GENERAL_INFO'); ?></a></li>
<li><a href="#tab2" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_EDUCATION'); ?></a></li>
<li><a href="#tab3" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_PETS'); ?></a></li>
<li><a href="#tab4" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_POP_CULTURE'); ?></a></li>
<li><a href="#tab5" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_TEAM_UPDATES'); ?></a></li>
<li><a href="#tab6" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_SHOUT_OUT'); ?></a></li>
<li><a href="#tab7" data-toggle="tab"><?php echo Text::_('RSFORM_TAB_SUGGESTIONS'); ?></a></li>
</ul>

However, the tabs are empty. Am I missing something? (I have also tried with JText::).

My system info:

PHP Version: 8.1.29
Joomla! Version: Joomla! 5.2.4 Stable

Thank you for any help you can provide.

Best,

Pascal
Last Edit: 3 weeks 6 days ago by pwickert. Reason: Minor edit on text error
The administrator has disabled public write access.

Using Text:: in Layout without success 3 weeks 5 days ago #43890

  • pwickert
  • pwickert's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Thank you received: 2
I finaly found the resolution of my issued by poking around. I have added the following in the PHP Script called on Form Display:
$formLayout = str_replace(
    [
        'General Info',
        'Education',
        'Pets',
        'Pop Culture',
        'Team Updates',
        'Shout Out',
        'Suggestions'
    ],
    [
        JText::_('RSFORM_TAB_GENERAL_INFO'),
        JText::_('RSFORM_TAB_EDUCATION'),
        JText::_('RSFORM_TAB_PETS'),
        JText::_('RSFORM_TAB_POP_CULTURE'),
        JText::_('RSFORM_TAB_TEAM_UPDATES'),
        JText::_('RSFORM_TAB_SHOUT_OUT'),
        JText::_('RSFORM_TAB_SUGGESTIONS')
    ],
    $formLayout
);

I hope this helps others.

Best,

Pascal
The administrator has disabled public write access.

Using Text:: in Layout without success 3 weeks 5 days ago #43891

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 245
  • Thank you received: 64
It might need a slight change for Joomla 5 if Jtext::_ is deprecated. Jtext was still supported in J4 but started to use the namespace convention
use Joomla\CMS\Language\Text;
 
$formLayout = str_replace(
    [
        'General Info',
        'Education',
        'Pets',
        'Pop Culture',
        'Team Updates',
        'Shout Out',
        'Suggestions'
    ],
    [
        Text::_('RSFORM_TAB_GENERAL_INFO'),
        Text::_('RSFORM_TAB_EDUCATION'),
        Text::_('RSFORM_TAB_PETS'),
        Text::_('RSFORM_TAB_POP_CULTURE'),
        Text::_('RSFORM_TAB_TEAM_UPDATES'),
        Text::_('RSFORM_TAB_SHOUT_OUT'),
        Text::_('RSFORM_TAB_SUGGESTIONS')
    ],
    $formLayout
);
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.
The following user(s) said Thank You: gregs

Using Text:: in Layout without success 3 weeks 5 days ago #43892

  • pwickert
  • pwickert's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
  • Thank you received: 2
Hello iceferret,

I tried it, but I got the following error message:

0
Class "Text" not found

I am using the latest Joomla! version 5.2.4

Any idea why it's not working with Text::?

Thanks
The administrator has disabled public write access.

Using Text:: in Layout without success 3 weeks 5 days ago #43893

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 245
  • Thank you received: 64
if JText works then it's possibly an issue with the use of the use class within rsform itself. The joomla autoloader should figure out the correct path to the Text file in /libraries/src/Language/,
if your code works then stick with it. B)
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.
The following user(s) said Thank You: pwickert
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!