?
avatar PhilETaylor
PhilETaylor
21 Jun 2020

Steps to reproduce the issue

Enable language debugging in Joomla 4 and create yourself a menu item pointing to Search.

Visit the menu item

Screenshot 2020-06-21 at 20 46 52

NOTE the lack of translated placeholder text

Expected result

Well here is where it gets complex.

The debug toolbar says that MOD_FINDER_SEARCH_VALUE is untranslated

So you go down the rabbit hole looking for MOD_FINDER_SEARCH_VALUE and you find its used as

Text::script('MOD_FINDER_SEARCH_VALUE', true);

However once the value is added to JS its not actually then used as the place holder of the input field for the search

So the fix is

  • wanting to actually use the JS language string somewhere, then we need a
Factory::getLanguage()->load('mod_finder');

in the com_finder - tmpl/search/default.php before Text::script('MOD_FINDER_SEARCH_VALUE', true);

  • Then we ALSO NEED some javascript (beyond me!) to populate this translated string as a placeholder of the input box (like the search MODULE does correctly)

Actual result

 "joomla.jtext": {
            "MOD_FINDER_SEARCH_VALUE": "??MOD_FINDER_SEARCH_VALUE??",
            "JSHOWPASSWORD": "**Show Password**",
            "JHIDEPASSWORD": "**Hide Password**"
        },

Screenshot 2020-06-21 at 20 42 20

System information (as much as possible)

Safari on Mac

Additional comments

Compare with the search MODULE which has a placeholder:

Screenshot 2020-06-21 at 20 47 26

avatar PhilETaylor PhilETaylor - open - 21 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - change - 21 Jun 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Jun 2020
avatar PhilETaylor PhilETaylor - change - 21 Jun 2020
Title
[4.0] MOD_FINDER_SEARCH_VALUE when
[4.0] MOD_FINDER_SEARCH_VALUE when used as a component
avatar PhilETaylor PhilETaylor - edited - 21 Jun 2020
avatar brianteeman
brianteeman - comment - 22 Jun 2020

Unless I am very much mistaken the line is a copy paste error and should not be there.

The module is populated because it has "placeholder="' . Text::_('MOD_FINDER_SEARCH_VALUE')"

avatar infograf768
infograf768 - comment - 22 Jun 2020

Indeed. We have to modify the default.form.php to get

<input type="text" name="q" id="q" class="js-finder-search-query form-control" value="<?php echo $this->escape($this->query->input); ?>" placeholder="<?php echo Text::_('MOD_FINDER_SEARCH_VALUE'); ?>">

But I see no reason to load the module lang file and use MOD_FINDER_SEARCH_VALUE.
We would be better creating a new string in com_finder.ini
COM_FINDER_SEARCH_VALUE="Search ..."

and use that as placeholder

Screen Shot 2020-06-22 at 11 29 32

What do you think?

avatar PhilETaylor
PhilETaylor - comment - 22 Jun 2020

well that depends if you want a placeholder or not... :-)

avatar brianteeman
brianteeman - comment - 22 Jun 2020

The reason for having a placeholder on the module is because you have the option to display the input without the button. As that is not an option in the component I would not have the placeholder and simply remove the line that was added in error

avatar PhilETaylor
PhilETaylor - comment - 22 Jun 2020
avatar PhilETaylor PhilETaylor - change - 22 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-22 11:49:57
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - close - 22 Jun 2020

Add a Comment

Login with GitHub to post a comment