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 8386885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:04:09+00:00 2026-06-09T18:04:09+00:00

Hi I have a form element error and it keeps breaking it when I

  • 0

Hi I have a form element error and it keeps breaking it when I wrap it in the translation function. I am using gettext for the translation.

I understand that if I have it set in the registry and Zend_Form it should pick it up automatically but how does poedit see it if at all?

My Bootstrap (Relevant Part):

    // Set the instance of Zend_Translate in the registry
    $registry->set('Zend_Translate', $translate);
    // Set an instance of Zend Translate object for validators
    Zend_Form::setDefaultTranslator($translate);

My Error Form:

public function formErrors(Zend_Form $form)
{       
        $registry = Zend_Registry::getInstance();
        $translate = $registry->get('Zend_Translate');
        $form->setTranslator($translate);

    if ($form->getMessages()) {
        $error = '<p class="errorBox">Error text here</p>';
        $error->setTranslator($translate);
        $error->getView()->translate($error);
        return $error;
    }
    return '';
}

Note:

 $this->translate('string to translate'); or $this->getView()->translate('string'); 

works everywhere else but not here

  • 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-06-09T18:04:11+00:00Added an answer on June 9, 2026 at 6:04 pm

    The usage within a form which I used on the last project was

    $this->getTranslator()->translate('text to translate')
    

    This was only used minorly as we had auto-detect resource paths so we did not need to call it. The way you want to use it does seem slightly different. I would recommend adding the extra call after getView() though as it could be the solution.

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

Sidebar

Related Questions

function focus(element) { document.form.element.focus(); } I want to have a function to focus on
If I have a form element that has multiple validators attached to it (3
I have a form element that I'm setting as required: $this->addElement('text', 'email', array( 'label'
I have a web form that is built dynamically with dozens/hundreds of form element
I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
I have a form element defined as: <div class=field> <div class=name> <label for=User_LastName> Last
Okay so say I have a form element like this: HTML: <div class=form-item> <label>Current
I have a select form element with 5 options. If option 2 is selected
I have included Zend_Form_Element_Hash into a form multiplecheckbox form. I have jQuery set to
I have a webpage with a form element and a popup window (opened by

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.