Page 1 of 1

Translate $ tomorrowdaylength?

Posted: Sun 15 Mar 2015 10:33 am
by MeteoBisignano
Good Sunday to all
I wanted to ask how do I make it into another language (Italian) the
following WebTAG Cumulus $ tomorrowdaylength?

Re: Translate $ tomorrowdaylength?

Posted: Sun 15 Mar 2015 12:48 pm
by steve
If you want to translate it, you'll have to parse the string and convert it yourself.

Re: Translate $ tomorrowdaylength?

Posted: Sun 15 Mar 2015 3:09 pm
by MeteoBisignano
steve wrote:If you want to translate it, you'll have to parse the string and convert it yourself.
Hi Steve and good Sunday.
Unfortunately I do not remember the file to edit, do not even remember its location

Re: Translate $ tomorrowdaylength?

Posted: Sun 15 Mar 2015 3:16 pm
by steve
It's not in any files that are supplied with Cumulus, it is simply a web tag - <#tomorrowdaylength> - so I can't help with you with what file it is in. If you're using the web tag already, it must be in a file that you have told Cumulus to process, on the files tab of the internet settings. The fact that you have used a '$' rather than the usual web tag format suggests that it may be in a PHP file.

Re: Translate $ tomorrowdaylength?

Posted: Sun 15 Mar 2015 4:31 pm
by laulau
This php fonction converts $DL ($tomorrowdaylength) in +- Xmin XXs
Capt.JPG

Code: Select all

function CVRTDAYL($DL) {
	$marqueurDL = "be ";
	$debutDL = strpos( $DL, $marqueurDL ) + strlen( $marqueurDL );
	
	$sign = "- ";
	$finDL = strpos( $DL, " less" );
	if ($finDL == 0)
		{
		$sign = "+ ";
		$finDL = strpos( $DL, " more" );
		}

	$textDL = substr( $DL, $debutDL, $finDL - $debutDL );
	 return $sign.$textDL;
	}

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 9:01 am
by MeteoBisignano
laulau wrote:This php fonction converts $DL ($tomorrowdaylength) in +- Xmin XXs
Capt.JPG

Code: Select all

function CVRTDAYL($DL) {
	$marqueurDL = "be ";
	$debutDL = strpos( $DL, $marqueurDL ) + strlen( $marqueurDL );
	
	$sign = "- ";
	$finDL = strpos( $DL, " less" );
	if ($finDL == 0)
		{
		$sign = "+ ";
		$finDL = strpos( $DL, " more" );
		}

	$textDL = substr( $DL, $debutDL, $finDL - $debutDL );
	 return $sign.$textDL;
	}



I inserted the function suggested in the file that processes Cumulus (wt_data_intl.php) but it does not happen nulla.Evidentemente mistake to add in the right place

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 9:19 am
by laulau
Hi,
If you are using a 'cumuluwebtags.php' file with all the webtags or something equivalent, just put it at the end of the file and create a new variable that calls the function:

Code: Select all

$tomorrowdaylength    = "<#tomorrowdaylength>";  //  string giving the difference between the length of day today and tomorrow
$tomorrowDL           =CVRTDAYL($tomorrowdaylength)
If you include the cumuluwebtags.php in a web page you can then use $tomorrowDL instead of $tomorrowdaylength

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 9:42 am
by MeteoBisignano
laulau wrote:Hi,
If you are using a 'cumuluwebtags.php' file with all the webtags or something equivalent, just put it at the end of the file and create a new variable that calls the function:

Code: Select all

$tomorrowdaylength    = "<#tomorrowdaylength>";  //  string giving the difference between the length of day today and tomorrow
$tomorrowDL           =CVRTDAYL($tomorrowdaylength)
If you include the cumuluwebtags.php in a web page you can then use $tomorrowDL instead of $tomorrowdaylength

As suggested I put the function in the bottom of the page like this:
  $LatestErrorTime = "<#LatestErrorTime>"; // The time of the latest error logged to the error log window, using the system short time format. Gives a when dashes latest error is reset

CVRTDAYL function ($ DL) {
    $marqueurDL = "be";
    $debutDL = strpos ($ DL, $marqueurDL) + strlen ($marqueurDL);
   
    $sign = "-";
    $Findl = strpos ($ DL, "less");
    if ($ Findl == 0)
       {
       $ sign = "+";
       $ Findl = strpos ($ DL, "more");
       }

    $ textDL = substr ($ DL, $ debutDL, Findl $ - $ debutDL);
     return $ sign. $ textDL;
    }
//====================================================================================================================
//
$tomorrowDL = CVRTDAYL ( $tomorrowdaylength)

?>

but does not work

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 10:20 am
by MeteoBisignano
the WebTAG

$ tomorrowDL = CVRTDAYL ($ tomorrowdaylength)

must be included, or so we must add also:

$ tomorrowDL = <"CVRTDAYL ($ tomorrowdaylength)">; ?

The function previously attached is inserted in the file cumuluwebtag.php beginning or at the end of the code? It must be so set?
<? php function CVRTDAYL ($ DL) {
    $ marqueurDL = "be";
    $ debutDL = strpos ($ DL, $ marqueurDL) + strlen ($ marqueurDL);
   
    $ sign = "-";
    $ Findl = strpos ($ DL, "less");
    if ($ Findl == 0)
       {
       $ sign = "+";
       $ Findl = strpos ($ DL, "more");
       }

    $ textDL = substr ($ DL, $ debutDL, Findl $ - $ debutDL);
     return $ sign. $ textDL;
    };?>

Thanks for your patience and help meticulous

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 10:53 am
by laulau
The link to my cumuluswebtags.php : http://meteo.laurentmey.fr/php/cumulusw ... ource=view

And in my web pages :

Code: Select all

<?php 
 require_once("cumuluswebtags.php");
?>

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 12:24 pm
by MeteoBisignano
Now it works perfectly.
Thank you for your patience and precision demonstrated.
I had a look at your site and I noticed a dial dashboard 2.5.5
I wanted to know how do I add the graph "Base clouds" in section trend.php?
Thanks again for the support
Weather Station bisignano.it

Re: Translate $ tomorrowdaylength?

Posted: Mon 16 Mar 2015 2:51 pm
by laulau

Re: Translate $ tomorrowdaylength?

Posted: Tue 17 Mar 2015 7:57 am
by MeteoBisignano
He tells me that "are not authorized to view the page"

Re: Translate $ tomorrowdaylength?

Posted: Tue 17 Mar 2015 7:03 pm
by duke
MeteoBisignano wrote:
He tells me that "are not authorized to view the page"
Yes, you do not have access to the MX part of the forum.