Zend_Translate and translation issues - zend-framework

I wonder how I could translate the following?
(french) Vous avez oublié votre mot de passe ?
(english) Forgot your password ?
(dutch) Paswoord vergeten ?
As you may notice, the problem is that in the dutch version, the sentence starts with password and in the french and english version, it starts with the subject/verb.
I usually do it like this:
<?php echo $this->translate('Vous avez oublié votre'); ?>
<?php echo $this->translate('mot de passe'); ?> ?
Unfortunately that won't work here because as said earlier in the dutch version the sentence starts with the password.

You have to use embedded parameters ( %1\$s): http://framework.zend.com/manual/en/zend.translate.using.html

Related

How do i add a placeholder to a Multiselect form field on mobile devices

I'm using Code Ignitor to generate a multiselect form using the form_multiselect() function. I don't however believe this issue is specific to CI, rather the way that mobile browsers render multiselect form fields.
My form code:
<div id="searchform" class="search search-form search-horizontal">
<?php
$detectselect = isset($selecteddetec) ? $selecteddetec : '';
$gasselect = isset($selectedgases) ? $selectedgases : array();
echo form_open('searchproduct', array('name' => 'contact', 'class' => 'searchproduct'));
echo ('<div class="boxes">');
echo form_label('Type of detector', 'typeofdetect');
echo form_dropdown('typeofdetect', $detecttype, $detectselect);
echo ('</div>');
echo ('<div class="boxes">');
echo form_label('Gases to detect', 'gastodetect[]');
echo form_multiselect('gastodetect[]', $gasdetectopt, $gasselect, 'class="gas-multiselect" placeholder="Choose gases..."');
echo ('</div>');
echo form_hidden(array('posturi' => $pgalias));
echo form_submit('submit', 'Search', "class='buttons'");
?>
</form>
</div>
On a desktop browser, the form has the Chosen jQuery library applied which in turn handles the placeholders for the fields, these work correctly.
On mobile devices the Chosen library is disabled so normal form markup is used. The placeholder for the single select field works as expected however the multiselect displays '0 Selected' by default and nothing i do seems to change that.
Does anyone have any experience with overriding it? passing a placeholder attribute through the form_multiselect() function makes no difference, and I can't find any answers online. We need a placeholder as on mobile devices we have no form labels (and due to space in the display, we would really rather avoid them)
Edit:: Screenshot of the issue
Edit 2::
I have accepted Dray's answer below, for completeness this is what i needed to pass into the options array in code ignitor.
$a['0" default selected disabled="disabled'] = 'Choose gases...';
you can make the first option of your select field as:
<option value="" default disabled selected>
Your place holder here
</option>
P.S. This is just a workaround.

iphone HTML entities not interpreted

I am currently working on a website for a client, who encounters a bug that even I am not able to reproduce...
Here is a page example : http://newsletter.thenextgag.com/#/5/2014-01-02
My client is using an iphone to navigate through the website and seems to encounter a realy weird bug : it looks like HTML entities are not interpreted, or that special characters are transformed into HTML entities and not showing correctly. Here is the image he produced to me :
Do you have an idea ? I made some search but was unable to find anything on it..
I am using HTML5 and AngularJS, but I can't see why it should change anything..
Thanks
I see you're using Angular 1.2.3 and the linky filter. There seems to be some changes in 1.2.4 in $santize, that the linky filter uses, that affects how it handles escaped/entity characters.
If you create an extremely simple page, with the following controller:
app.controller('MainCtrl', function($scope) {
$scope.content = "L\u2019appli iPhone de l\u2019ann\u00e9e. Qui n\u2019a pas perdu un ou des amis \u00e0 cause de leur addiction \u00e0 ces bonbons ?";
});
with a template:
<div ng-bind-html="content | linky"></div>
Then using Angular 1.2.3 on an iPhone (in my case, iPhone 4 running IOS 7.04), the output is:
L’appli iPhone de l’année. Qui n’a pas perdu un ou des amis à cause de leur addiction à ces bonbons ?L’appli iPhone de l’année. Qui n’a pas perdu un ou des amis à cause de leur addiction à ces bonbons ?L’appli iPhone de l’année. Qui n’a pas perdu un ou des amis à cause de leur addiction à ces bonbons ?L’appli iPhone de l’année. Qui n’a pas perdu un ou des amis à cause de leur addiction à ces bonbons ?
But doing the same thing on Angular 1.2.4 results in
L’appli iPhone de l’année. Qui n’a pas perdu un ou des amis à cause de leur addiction à ces bonbons ?
I'm testing using https://npmjs.org/package/http-server on a Mac, in case there are some other issues at work that means this can't be reproduced everywhere.
So my solution would be to change the version of Angular you're using to 1.2.4 or later.

no body on email from cfmail

I have this code that is sending an email to me when some query is running on database from coldfusion. I'd receive the email without problems but there is no body on it, only shows the subject. I tryed using no type on cfmail tag and changing the cfmailpart tag type="html" for type="text", but nothing happens. The funny thing is that in my local folder CF8/mail/undelivr i can see the body of the email and shows itself without problems, but when this code go to production, doesn't work. Some clue about what is happening?
this is the code i'm using now:
<cfset fechaActual = dateformat(Now(),"dd-mm-yyyy") >
<cfset horaActual = TimeFormat(now(), "HH:mm:ss") >
<cfset archivoActual = CGI.http_host & CGI.script_name & "?" & CGI.query_string>
<cfmail type="html" to="xxx#xxx.com,xxx#xxx.com,xxx#xxx.com" from="xxx#xxx.com" subject="Delete tabla xxx #fechaActual# hrs.">
<cfmailpart type="text">
Este aviso indica que ha sido ejecutado un DELETE en la tabla xxx.
Hora de ejecución: #horaActual#
Fecha de ejecución: #fechaActual#
Ruta:D:\xxx\xxx\xxx\xxx\xxx.cfm
Url: #archivoActual#
Linea: xx
IDs Eliminados: #idaviso#
</cfmailpart>
</cfmail>
Thank you!!!
best regards
I suggest using both text and HTML cfmailparts. Including both increases the probability that they will be readable by everyone. You might want to make the text only cfmailpart very basic with limited information.
Be sure to include text only within the text cfmailpart and HTML formatted text in the HTML cfmailpart.
<cfmail type="html">
<cfmailpart type="text">
Este aviso indica
</cfmailpart>
<cfmailpart type="html">
<p>Some HTML words</p>
</cfmailpart>
</cfmail>

Date format in a function WordPress ACF

I have asked a similar question in the past but still have issues...
I am therefore placing the whole function here.
Can anyone tell me how to change the format that the date is output?
Currently it shows 20130731
I want it to show 31st July 2013
function le_detail() {
?>
<div class="event">
<!--Standard WP - use 'echo' -->
<h2 class="button"> <?php echo get_the_title(); ?> </h2>
<!-- ACF - NO 'echo' -->
<h3><?php the_field('where'); ?></h3>
<h3><?php the_field('when'); ?></h3>
<p><?php the_field('description'); ?></p>
<p>Chairman: <?php the_field('chairman'); ?></p>
</div>
<?php
}
The date is the line: (this is using the Advanced Customs Fields plugin)
<h3><?php the_field('when'); ?></h3>
Yes, I had this same problem until I tried it this way:
$date = DateTime::createFromFormat('Ymd', get_field('my_datefield'));
//use your field name
then...
<li>Ticket Date: <?php echo $date->format('d M, Y'); ?> </li>
Good Luck!
ACF plugin is having get_field('') function to get the value of the custom field. Since you have used 'when' as the field name, so do as follows:
<h3><?php echo date("dS F,Y",strtotime(get_field('when'))); ?></h3>
Use the above code snippet, that will solve your problem.

Zend_Currency Displaying Extra Character

I was trying to use Zend_Currency to format my currency outputs and i face this queer problem. An illegal character(Â) gets displayed along with the output of the currency data. The code i used is:
$currency = new Zend_Currency('en_IN');
echo $currency->toCurrency(100);
And the output is:
Rs 100.00
I dont know from where the "Â" comes up. I found out that this problem occurs for certain locales only. It is working fine for en_US and some others but output this extra char  in many other. Some one please help.
Put this in your layout header, this is an regular encoding issue.
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
To expand on Elzo's answer, I have this in my Bootstrap.php:
$this->bootstrap('view');
$view = $this->getResource('view');
$view->headMeta()->setHttpEquiv('Content-Type', 'text/html; charset=utf-8');
This is in my layout:
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
</head>