Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7444899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:36:38+00:00 2026-05-29T11:36:38+00:00

I am trying to localize an existing cakephp application. For the most part I

  • 0

I am trying to localize an existing cakephp application. For the most part I have it working the way I want but there is one scenario I can’t figure out.

I am using the form helper to create a form like this:

echo $this->Form->create('search', array('url' => 
     array('controller' => '/', 
           'action' => '/search/searcher'),
           'onsubmit'=>'return checkForm();', 
           'class'=>'find-form'));
echo '<fieldset>';
echo $this->Form->input('name', array(
             'type'=>'hidden', 
             'div'=>false, 
             'id'=>'name', 
             'class'=>'nice', 
             'label'=>false,
             'value'=>''
             ));

echo $this->Form->input('myvalue', array(
             'type'=>'text',
             'div'=>false,
             'id'=>'searchval',
             'class'=>'nice',
             'value'=> __('Enter search string'),
             'label'=>false));

The problem is with the line:

 'value'=> __('Enter search string'),

The resulting html looks like this:

 ...
 <fieldset>
   <input type="hidden" name="data[search][name]" 
      id="name" value="" />
   Enter Search String
   <input name="data[search][myvalue]" 
             type="text" 
             id="searchval" 
             class="nice"

       and so on.

The value “Enter Search String” is translated properly but it is outside of the input tag so it shows up outside of the search box.

I’ve tried various permutations of the code like:

 'value'=> echo __('Enter search string'),
 'value'=> `__('Enter search string')`,

And nothing seems to work. As I said it works in other areas of the view (in as an array value though) but I can’t get this one working.

BTW, the code before I started looked like this:

 'value'=> 'Enter search string',

Any ideas?

Thanks for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:36:39+00:00Added an answer on May 29, 2026 at 11:36 am

    In CakePHP 1.x the __() function echoes the content by default, while in this case you only want to store it. You can use the second argument to return rather than echo the contents, like this:

    'value' => __('Enter search string', true),
    

    From CakePHP 2.0 on upwards you should no longer have to do this, as it returns by default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to localize an application, but I have a couple restrictions. I
I have a problem when trying to localize my application. It is available in
Trying to localize text in ASP.NET labels... want to add a ':' after the
I am trying to localize an existing app that has the following logic that
I'm trying to localize client side Javascript in a ASP .NET MVC application. The
I'm trying to localize error messages from NHibernate.Validator. From what I have read, the
I am trying to localize images in JSF, and I want the user to
I'm trying to localize my application, and it would be nice if I could
I am trying to localize everything to a namespace in javascript. So I have
I've just made an application in Xcode, and I'm trying to localize it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.