Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Fri Aug 04, 2006 11:01 am Reply with quote

Hi!

I'm testing the HTML Newsletter script and so far everything seams to work fine, but I noticed that the date is in English!
I need to change this and I wonder if you could give me a clue on this.
It isn't in the lang files?
Perhaps in a function?

I need to translate the date to Portuguese.

Thanks for the script! Very Happy
 
View user's profile Send private message
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Fri Aug 04, 2006 11:28 am Reply with quote

Me again!
Did some research!

Found this function in the script admin folder. I think this is it, but when I uncomment the code the test email is not sent. What to do?
Code:

function msnl_fFormatDate( $format, $gmepoch, $tz ) {

   global $msnl_asPHPBBCfg, $lang;

   static $translate;

/* MSNL_010301_06
   if ( empty( $translate ) && $msnl_asPHPBBCfg['default_lang'] != 'english' ) {

      @reset( $lang['datetime'] );

      while ( list( $match, $replace ) = @each( $lang['datetime'] ) ) {

         $translate[$match] = $replace;

      }

   }
*/

   return ( !empty( $translate ) ) ? strtr( @gmdate( $format, $gmepoch + (3600 * $tz) ), $translate ) : @gmdate( $format, $gmepoch + (3600 * $tz) );

} //End of function msnl_fFormatDate()
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Fri Aug 04, 2006 4:55 pm Reply with quote

You are correct in that this is where the date gets formatted. I had taken that date routine from the phpBB code (forums), but for some reason, it would not work for Persian either. I had to comment it out in order to keep it from causing the issue you are describing.

Unfortunately, I have not had any time to address this issue, nor will I get the time in the forseable future. You could download the Persian version and see what they had done, as it might give you an idea how to modify it for your language.

Sorry about this. It is going to be a few months yet before I can even consider taking on version 1.4.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Fri Aug 04, 2006 5:42 pm Reply with quote

Actually had someone cancel their meeting with me and looked at it a little bit. Are you seeing the correct date format on your PHP-Nuke news articles? If so, is that the format that you would like to use?

Regardless, please tell me what your Administration --> Preferences --> Locale Time Format: field has in it. For example, mine has "en_US".

Also, please post back what you have for the following two lines in your language/lang-portuguese.php script:

define("_DATESTRING","%A, %B %d @ %T %Z");
define("_DATESTRING2","%A, %B %d");

These lines I just posted are from my English version.

What should the date look like? Please give an example of how you want it to look.

Thanks,
montego

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Sat Aug 05, 2006 7:34 am Reply with quote

Hi!
Thanks for replying.

My news articles date was incorret. I had to alter the formatTimestamp funtion in the main.php file, like this:

Code:

/*********************************************************/
/* formatting stories                                    */
/*********************************************************/

function formatTimestamp($time) {
/* código original por vitoreis de www.portalclassicos.com */
/* Adaptação para ser independente da língua por LuBoc (ptnuke.com) */
/* para que nas notícias apareça a data em português */

global $datetime, $locale;
setlocale (LC_TIME, "$locale");
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
$ano=$datetime[1]+0;
$mes=$datetime[2]+0;
$dia=$datetime[3]+0;

// devem colocar a diferença horária entre o vosso país e o servidor
$hora=$datetime[4]+1;
// (exemplo + 4 ou -3)

if ( $hora <0> 24) $hora = $hora - 24;
if ( $hora == 24) $hora = 0;
$min=$datetime[5]+0;
$longitud=strlen($min);
if ($longitud == 1) $min="0".$min;
$segs=$datetime[6]+0;
$longitud=strlen($segs);
if ($longitud == 1) $segs="0".$segs;
$quedia= strftime ("%w", mktime($hora,$min,$segs,$mes,$dia,$ano));
switch($quedia) {
case 0:
$quedia=""._DATADOMINGO."";
break;
case 1:
$quedia=""._DATASEGUNDA."";
break;
case 2:
$quedia=""._DATATERCA."";
break;
case 3:
$quedia=""._DATAQUARTA."";
break;
case 4:
$quedia=""._DATAQUINTA."";
break;
case 5:
$quedia=""._DATASEXTA."";
break;
case 6:
$quedia=""._DATASABADO."";
break;
}
switch($mes) {
case 1:
$mes=""._DATAJANEIRO."";
break;
case 2:
$mes=""._DATAFEVEREIRO."";
break;
case 3:
$mes=""._DATAMARCO."";
break;
case 4:
$mes=""._DATAABRIL."";
break;
case 5:
$mes=""._DATAMAIO."";
break;
case 6:
$mes=""._DATAJUNHO."";
break;
case 7:
$mes=""._DATAJULHO."";
break;
case 8:
$mes=""._DATAAGOSTO."";
break;
case 9:
$mes=""._DATASETEMBRO."";
break;
case 10:
$mes=""._DATAOUTUBRO."";
break;
case 11:
$mes=""._DATANOVEMBRO."";
break;
case 12:
$mes=""._DATADEZEMBRO."";
break;
}
$datetime = "$quedia, $dia de $mes de $ano ($hora:$min:$segs) ";
return($datetime);

}
//function formatTimestamp($time) {
   // global $datetime, $locale;
   // setlocale (LC_TIME, $locale);
    //ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
   // $datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
    //$datetime = ucfirst($datetime);
   // return($datetime);
//}



My Administration --> Preferences --> Locale Time Format: pt_PT

Lines in my language/lang-portuguese.php script:
define("_DATESTRING","%A, %d de %B @ %T %Z");
define("_DATESTRING2","%A, %d de %B");


I want the date to look like in the news: http://es-arq-of.prof2000.pt
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Aug 05, 2006 9:09 am Reply with quote

Ok, if you want the Send Date and the forum Post Date to look like your articles, try these edits:

Code:

=== OPEN FILE ===

modules/HTML_Newsletter/admin/admin_make_nls.php

=== FIND CODE ===

$msnl_sSendDate      = date("F d Y");                                           //Replaces the {DATE} tag

=== REPLACE WITH ===

$msnl_sSendDate      = formatTimestamp(date("Y-m-d H:i:s"));         //Replaces the {DATE} tag

=== FIND CODE ===

         $msnl_sPostTime                     = msnl_fFormatDate( $msnl_asPHPBBCfg['default_dateformat'],
                                                         $row['post_time'], $msnl_asPHPBBCfg['board_timezone'] );

=== REPLACE WITH ===

         $msnl_sPostTime                     = formatTimestamp(date("Y-m-d H:i:s", $row['post_time']));


Please let me know if this works for you.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Sat Aug 05, 2006 11:53 am Reply with quote

No email is sent!!!!
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Aug 05, 2006 1:06 pm Reply with quote

Must be a parse error somewhere. Do you have display errors set to "true" in your config.php? If not, turn it on and report back any errors you see (but be careful to not post sensitive info here like full path names).

This works in my local setup. Double-check your edits.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Sat Aug 05, 2006 1:29 pm Reply with quote

I get no errors!!!
My edits look fine! Sad
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Aug 05, 2006 2:57 pm Reply with quote

Do you at least get to the Preview page where you can see if the date fields are coming out right? One issue at a time...

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Sun Aug 06, 2006 4:20 am Reply with quote

When I hit "Preview" a diferent page apears but there is no preview, just the title anouncing the preview.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sun Aug 06, 2006 9:41 am Reply with quote

Please comment out those two lines I had you change and try again. I want to make sure we do not have another problem that is stopping this from working.

Also, to format your news articles, did you change the $time variable PRIOR to calling formatTimestamp? It is supposed to be in the format of "YYYY-MM-DD hh:mm:ss" coming into that function, at least in my nuke installation.

By the way, I am leaving on a family trip Monday morning and may take awhile to respond to you in the coming week. Guardian may be popping in here from time-to-time and try to help out too.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Sun Aug 06, 2006 12:33 pm Reply with quote

I did comment out those two lines and the email is sent with the date in English.

No change was made to the variable $time. The only ganges made were in the funtion formatTimestamp and in the Lang file to include the proper translation:

Code:



/*****************************************************/
/* Funções para a Data no mainfile.php */
/*****************************************************/
define("_DATADOMINGO","Domingo");
define("_DATASEGUNDA","Segunda");
define("_DATATERCA","Terça");
define("_DATAQUARTA","Quarta");
define("_DATAQUINTA","Quinta");
define("_DATASEXTA","Sexta");
define("_DATASABADO","Sábado");
define("_DATAJANEIRO","Janeiro");
define("_DATAFEVEREIRO","Fevereiro");
define("_DATAMARCO","Março");
define("_DATAABRIL","Abril");
define("_DATAMAIO","Maio");
define("_DATAJUNHO","Junho");
define("_DATAJULHO","Julho");
define("_DATAAGOSTO","Agosto");
define("_DATASETEMBRO","Setembro");
define("_DATAOUTUBRO","Outubro");
define("_DATANOVEMBRO","Novembro");
define("_DATADEZEMBRO","Dezembro");



/*****************************************************/
/* Function to translate Datestrings                 */
/*****************************************************/

function translate($phrase) {
    switch($phrase) {
   case "xdatestring":   $tmp = "%A, %d de %B @ %T %Z"; break;
   case "linksdatestring":   $tmp = "%d-%b-%Y"; break;
   case "xdatestring2":   $tmp = "%A, %d de %B"; break;
   default:      $tmp = "$phrase"; break;
    }
    return $tmp;
}



Have a nice trip! Very Happy
 
View user's profile Send private message
patcunha
Newbie
Newbie



Joined: May 16, 2006
Posts: 9

PostPosted: Tue Aug 08, 2006 12:45 pm Reply with quote

Hello!

All I want now is to change the date in the newsletter title. I have August 03 2006 and I want 03/08/2006. For that i changed date("F d Y"); in modules/HTML_Newsletter/admin/admin_make_nls.php to date("j/n/Y"); and it didn't work: the email isn't sent. Sad Question Shocked
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Tue Aug 08, 2006 3:07 pm Reply with quote

Replace your admin_make_nls.php and functions.php that you have modified back to what was in the original distribution and try again. Make sure the email is sent WITHOUT any changes made by you.

I just tried the exact same date format that you mentioned above and mine is working just fine. You must still have some old code changes that are causing it to fail.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©