Search - Multilingual Placeholder

16 댓글

  • Trapta Singh
    Community Moderator

    Hi Colvin,

    Take a look at this tip: https://support.zendesk.com/hc/en-us/community/posts/115006078407-Add-multilingual-welcome-note-placeholder-text-in-search-box-along-with-user-name

    Let me know if this solves your issue.

    Thanks

    Team Diziana

    0
  • Colvin

    Hi, thanks for comment.

     

    Not found, the same error.

     

    Here the code: 

    {{search placeholder= "{{dc 'hc_search_greetings_template'}}" submit=false instant=settings.instant_search }}

     

    I''ve added id=query and I try some tricks but not found. 

    0
  • Pulkit Pandey
    Community Moderator

    Hi Colvin,

    Replace your search bar code with this 

    {{search submit=false instant=settings.instant_search class='search search-full'}}

    And follow the below steps

    1. Add a span tag in Header template (at the end, after </header> line)

    <span id="dc_greetings_template"
    data-value="{{dc 'hc_search_greetings_template'}}"
    style="display:none">
    </span>

    Note: Replace the hc_search_greetings_template  highlighted above with your dc i.e 'search_placeholder',  as you mentioned in your query above 

    2. Add a js in your script.js file

    $(document).ready(function() {

    var gtext = $("span#dc_greetings_template").data('value');
    $('#query').attr('placeholder', gtext);

    });

     

    Let me know if this solves your issue.

    Thanks 

    Pulkit 

    Team Diziana

     

    0
  • Trapta Singh
    Community Moderator

    Colvin, try below code:

    Replace

    {{search placeholder= "{{dc 'hc_search_greetings_template'}}" submit=false instant=settings.instant_search }}

    with

    {{search submit=false instant=settings.instant_search }}
    <span id="dc_placeholder_template" data-value="{{dc 'search_placeholder'}}" style="display:none"></span>

    and in your script.js file add:

    $(document).ready(function() {
    var splaceholder = $("span#dc_placeholder_template").data('value');
    $('#query').attr('placeholder', splaceholder);
    });

    Let me know if this helps you.

    Thanks

    Team Diziana

    0
  • Colvin

    Hi Diziana, 

    Thanks for the reply. Don't found :( 

    Not show the dynamic content placeholder as you can see. 

     

    • I've added the script in my script.js. 
    • I've added SPAN code.

     

    It seems to work by looking at the "inspector" of html.

    0
  • Pulkit Pandey
    Community Moderator

    Hi Colvin,

    Which Theme are you using, Can you please share the  full screenshot of the inspect, or you can share a URL of your help center so that I can check what causing the issue 

    Thanks

    Pulkit

    0
  • Pulkit Pandey
    Community Moderator

    Hi Colvin,

    Where did you paste the SPAN code on your project 

    Thanks 

    Pulkit

    0
  • Colvin

    Hi, 

    First, I've pasted the SPAN code on the top of "header.hbs" file. Then, I put it after the search field. As you put show me. 

     

    Thanks! 

    0
  • Trapta Singh
    Community Moderator

    Colvin, can you share the URL of your HC or see if there is an error showing in your console? Please share the screenshot of your script.js file where you have added the code.

    Team Diziana

    0
  • Colvin

    Hi!

    Yes, of course!

    The URL is: https://help.thecolvinco.com/hc/es

    The Screenshot: 

     

    First I've added the script inside "document.addEventListener('DOMContentLoaded', function() {" function but then I've added outside the function. 

    1
  • Trapta Singh
    Community Moderator

    @Colvin, replace:

    $(document).ready(function() {
    var splaceholder = $("#dc_placeholder_template").data('value');
    $('#query').attr('placeholder', splaceholder);
    });

    with

    var splaceholder = $("#dc_placeholder_template").data('value');
    $('#query').attr('placeholder', splaceholder);

    Let me know if it helps.

    Team Diziana

    0
  • Colvin

    Not found, very strange.

     

    0
  • Pulkit Pandey
    Community Moderator

    Hi Colvin,

    As I see on your HC you have placed your script outside the 

    document.addEventListener('DOMContentLoaded', function() {

    }

    On your Copenhagen Theme Please have a look on the screenshot I have attached its theme you are using i.e Copenhagen

     

    1.  Placed the SPAN tag in the header 

     

    2. Placed the script inside the document.addEventListener('DOMContentLoaded', function() in your script file 

    Let me know if it helps.

    Thanks 

    Pulkit 

    Team Diziana

    0
  • Xavi

    Hi!

    Yes! Found! By the other hand, I've deleted some class and id from code. I don't know why but found. 

     

    Thanks a lot!

    Xavi from Colvin. 

    0
  • Pulkit Pandey
    Community Moderator

    Hi Xavi,

    Glad to hear that you got it working. Enjoy :)

    Thanks 

    Pulkit 

    0
  • Jon Bolden

    There is now a much easier way using subexpressions:
    {{search submit=true instant=settings.instant_search class='search search-full' placeholder=(dc 'search_placeholder') }}

    0

댓글을 남기려면 로그인하세요.

Zendesk 제공