FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Adding the translate function to existing code.
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Adding the translate function to existing code. [message #178486] Fri, 22 June 2012 22:36 Go to next message
Nene is currently offline  Nene
Messages: 1
Registered: June 2012
Karma: 0
Junior Member
Hi,

Sorry I'm not a PHP guy.

I have this piece of PHP code that has this dialog box that has the
following code but I want to add the ability for Tar BZip2 , Tar GZip
radio button names to translate to another language using the
translate function. Below is the code. At the bottom of the page, I
have code that has the translate function and it works.

<div id="dlgCompress" class="yui-pe-content">
<div class="hd"><label id="dlgcompress_header"></label></div>
<div class="bd">
<form name="formCompressDlg">
<span class="compressMsg">
<label id="dlgcompress_msg"><?php echo $this-
> translate('DlgLabelNewArchName');?></label>
<input type="text" id="dlgcompressFileName"
name="dlgcompress_filename" size="32" maxlength="255" value="" /><br /
> <br />
<input type="radio" name="dlgcompress_type" value="Zip"
style="vertical-align: middle;" checked onclick="var o =
document.getElementById( 'dlgcompressFileName' ); if ( o ) if
( this.checked ) o.value = o.value.replace( /\..*$/, '' ) +
'.zip';">&nbsp;Zip Archive &nbsp;&nbsp;&nbsp;&nbsp;
<!-- input type="radio" name="dlgcompress_type" value="Tar"
style="vertical-align: middle;" onclick="var o =
document.getElementById( 'dlgcompressFileName' ); if ( o ) if
( this.checked ) o.value = o.value.replace( /\..*$/, '' ) +
'.tar';">&nbsp;Tar File &nbsp;&nbsp;&nbsp;&nbsp; -->
<input type="radio" name="dlgcompress_type" value="Tar"
style="vertical-align: middle;" onclick="var o =
document.getElementById( 'dlgcompressFileName' ); if ( o ) if
( this.checked ) o.value = o.value.replace( /\..*$/, '' ) +
'.tgz';">&nbsp;Tar GZip &nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="dlgcompress_type" value="Tar"
style="vertical-align: middle;" onclick="var o =
document.getElementById( 'dlgcompressFileName' ); if ( o ) if
( this.checked ) o.value = o.value.replace( /\..*$/, '' ) +
'.tar.bz2';">&nbsp;Tar BZip2 &nbsp;&nbsp;&nbsp;
<input type="hidden" id="dlgCompressFileId"
name="dlgcompress_fileid" size="32" maxlength="255" value="0" /></
span>
<br/>
</form>
</div>
<div class="ft">&nbsp;</div>
</div>

######
Here is an example that has the Zend_translate and it works.
<div class="bd">
<form name="formFileProp" class="yui-dialog">
<span><label class="lCol"><?php echo $this-
> translate('DlgLabelFileName');?></label></span>
<input type="text" name="dlgprop_filename" class="rCol"
size="32" maxlength="255"><br/>
<span><label class="lCol"><?php echo $this-
> translate('DlgLabelFileType');?></label></span>
<label id="dlgprop_filetype" class="rCol"></label>
<hr/>
<span><label class="lCol"><?php echo $this-
> translate('DlgLabelLocation');?></label></span>
<label id="dlgprop_fileloc" class="rCol"></label><br/>
<span><label class="lCol"><?php echo $this-
> translate('DlgLabelSize');?></label></span>
<label id="dlgprop_filesize" class="rCol">0 bytes</label>
<hr/>
<span><label class="lCol"><?php echo $this-
> translate('DlgLabelModified');?></label></span>
<label id="dlgprop_modified" class="rCol"></label><br/>
<span><label class="lCol"><?php echo $this-
> translate('DlgLabelAccessed');?></label></span>
<label id="dlgprop_accessed" class="rCol"></label>
<hr/>
<span style="white-space: nowrap;">
<span style="margin-left: 95px; display: inline-block; white-
space: nowrap;">
<label class="permUserHdr"><?php echo $this-
> translate('DlgLabelUser');?></label>
<label class="permGroupHdr"><?php echo $this-
> translate('DlgLabelGroup');?></label></span><br/>
<label class="permChkLabel" style="white-space: nowrap;"><?php
echo $this->translate('DlgLabelOwnership');?></label>
<select name="dlgprop_users" style="margin-left: 20px; width:
100px; display: inline-block;"></select>
<select name="dlgprop_groups" style="width: 100px; display:
inline-block;"></select></span>
<hr/>
<div>
<div>
<span style="white-space: nowrap; margin-left: 95px;">
<span style="width: 68px;"><label><?php echo $this-
> translate('DlgLabelRead');?></label></span>
<span style="width: 68px;"><label><?php echo $this-
> translate('DlgLabelWrite');?></label></span>
<span style="width: 68px;"><label><?php echo $this-
> translate('DlgLabelExecute');?></label></span></span>
</div>
<div>
<span><label class="permChkLabel"><?php echo $this-
> translate('lgLabelAccessOwner');?></label></span>
<input name="dlgprop_owner_read_access" style="width:
70px;" type="checkbox">
<input name="dlgprop_owner_write_access" style="width:
70px;" type="checkbox">
<input name="dlgprop_owner_exec_access" style="width:
70px;" type="checkbox">
</div>
Re: Adding the translate function to existing code. [message #178487 is a reply to message #178486] Fri, 22 June 2012 23:25 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/22/2012 6:36 PM, Nene wrote:
> Hi,
>
> Sorry I'm not a PHP guy.
>
> I have this piece of PHP code that has this dialog box that has the
> following code but I want to add the ability for Tar BZip2 , Tar GZip
> radio button names to translate to another language using the
> translate function. Below is the code. At the bottom of the page, I
> have code that has the translate function and it works.
>

<snip code>

Impossible to tell from your code. The translate function is a member
of a class, but not one supplied by PHP. It's hard telling what it's doing.

If you don't know PHP, I would recommend you hire a PHP programmer to
help you with it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Adding the translate function to existing code. [message #178490 is a reply to message #178486] Sat, 23 June 2012 15:12 Go to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 23.06.2012 00:36, schrieb Nene:
> Hi,
>
> Sorry I'm not a PHP guy.
>
> I have this piece of PHP code that has this dialog box that has the
> following code but I want to add the ability for Tar BZip2 , Tar GZip
> radio button names to translate to another language using the
> translate function. Below is the code. At the bottom of the page, I
> have code that has the translate function and it works.
>
--unreadable code cut--

Looks like you have to add the label text with the translate function, you will
probably have to add the entries to the message catalog as well. Then you have to
extend the code to handle the new selections.

No problem for a PHP programmer who knows Zend.

/Str.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: can't modify include path
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 05:35:42 GMT 2024

Total time taken to generate the page: 0.02847 seconds