Page 53 of 54

Re: Now available: AJAX/PHP multilingual website templates

Posted: Thu Apr 18, 2013 4:53 pm
by saratogaWX
In your Settings.php you need to have this

Code: Select all

$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language
 "styczeñ","luty","marzec","kwiecieñ","maj",
         "czerwiec","lipiec","sierpieñ","wrzesieñ","paŸdziernik","listopad","grudzieñ"
);

I know it looks funny, but the characters are the ISO-8859-1 versions (used by PHP).

Re: Now available: AJAX/PHP multilingual website templates

Posted: Wed Apr 24, 2013 9:13 pm
by Mark14
I used script above and it failed and then I changed the months' names for:

Code: Select all

$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language
"styczeñ","luty","marzec","kwiecieñ","maj",
         "czerwiec","lipiec","sierpieñ","wrzesieñ","paŸdziernik","listopad","grudzieñ"
);


I used html code for letter ñ because when I copy the word with ñ after pasting I received only n.

Still there is an issue. What should I check/correct next?

My website http://pogodaslesin.byethost11.com/wxindex.php

Re: Now available: AJAX/PHP multilingual website templates

Posted: Wed Apr 24, 2013 10:54 pm
by saratogaWX
You will need to use notepad or equivalent in ASCII (not UTF-8) mode to copy the listing of the months from language-pl.js into the Settings.php entry.

You can't use HTML entities (ñ etc) as PHP does not process those directly. It has to be the funny looking characters exactly, otherwise PHP can't convert the month names to English (which is all PHP understands), process it, and convert it back to Polish if needed.

The key is to edit using notepad in ASCII mode for both language-pl.js and Settings.php for this copy->paste.

Best regards,
Ken

Re: Now available: AJAX/PHP multilingual website templates

Posted: Thu Apr 25, 2013 8:25 pm
by Mark14
I have Notepad++. I set Encoding/Character Set/Western European - ISO 8859-1 and then pasted the script:

Code: Select all

$SITE['monthNames'] = array(  "styczeñ","luty","marzec","kwiecieñ","maj",
         "czerwiec","lipiec","sierpieñ","wrzesieñ","paŸdziernik","listopad","grudzieñ"
);

in my Settings.php and language-pl.js files. The characters was correct for ISO 8859-1. I transferred it to the server using Filezilla and ASCII transfer mode. Why is still the same problem?

Re: Now available: AJAX/PHP multilingual website templates

Posted: Thu Apr 25, 2013 10:07 pm
by saratogaWX
It looks like the wxastronomy.php page is now displaying correctly (with dates using Polish month names) thanks to you adding the $SITE['monthNames'] array using the ISO-8859-1 character set.

The issue with the wxstatus.php showing
Cumulus weather data NOT Current 379702:02:38 > 0:05:15
70-01-01 01:00
and your wxindex.php showing
Aktualizacja: @ 01-01-1970 00:03
for the time of update in PHP is caused by the date format used for your system running Cumulus. It is currently set to have dates as yyyy-mm-dd -- if you change the system to use dd/mm/yyyy format (and in Settings.php have $SITE['WDdateMDY'] = false; ) then the dates would be correctly decoded.

Best regards,
Ken

Re: Now available: AJAX/PHP multilingual website templates

Posted: Fri Apr 26, 2013 8:34 am
by Mark14
Thanks for the advice. The dates are correct now :) :clap:

However, when I set

Code: Select all

$SITE['WDdateMDY'] = false;
the text "dat" appeared on the top of my website. I don't know how it is connected but thermometer.php script also shows an error.

Moreover "updated .. sec ago" doesn't work - there is no countdown. Could you tell me where can I fix it?

http://pogodaslesin.byethost11.com/wxindex.php?lang=en#

Re: Now available: AJAX/PHP multilingual website templates

Posted: Fri Apr 26, 2013 3:49 pm
by saratogaWX
Hi Mark,

The 'dat' is appearing because there are extra characters at the start of your Settings.php file

Code: Select all

dat<?php
Change that to

Code: Select all

<?php
and the 'dat' will not appear. Both Settings.php and Settings-weather.php files need to have no characters or blank lines before the starting <?php and no blank lines or characters after the ending ?> at the bottom of the files.
Those extra 'dat' characters are also causing your thermometer.php to not display correctly.

The reason the AJAX update does not work due to a syntax error in the ajaxCUwx.js file

Code: Select all

vvar langBaroTrend = new Array (
should be

Code: Select all

var langBaroTrend = new Array (

Any JavaScript error on the page will stop execution of all JavaScripts on the page .. it is the funny way JavaScript works.

You should also know that you do not need to change the ajaxCUwx.js language settings area at all, and it should remain in English like

Code: Select all

// -- language settings -- you don't need to customize this area if you are using English -----

var langPauseMsg = 'Updates paused - reload page to start'; // substitute this for ajaxindicator when
                             // maxupdates has been reached and updating paused.

var langMonths = new Array ( "January","February","March","April","May",
         "June","July","August","September","October","November","December");
var langDays = new Array ( "Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun");   

var langBaroTrend = new Array (
 "Steady", "Rising Slowly", "Rising Rapidly", "Falling Slowly", "Falling Rapidly");

var langUVWords = new Array (
 "None", "Low", "Medium", "High",
 "Very&nbsp;High", /* be sure to include &nbsp; for space */
 "Extreme" );

var langBeaufort = new Array ( /* Beaufort 0 to 12 in array */
 "Calm", "Light air", "Light breeze", "Gentle breeze", "Moderate breeze", "Fresh breeze",
 "Strong breeze", "Near gale", "Gale", "Strong gale", "Storm",
 "Violent storm", "Hurricane"
);

var langWindDir = new Array( /* used for alt and title tags on wind dir arrow and wind direction display */
   "N", "NNE", "NE", "ENE",
   "E", "ESE", "SE", "SSE",
   "S", "SSW", "SW", "WSW",
   "W", "WNW", "NW", "NNW");

var langWindCalm = 'Calm';
var langGustNone = 'None';
var langWindFrom = 'Wind from '; /* used on alt/title tags on wind direction arrow*/

var langBaroRising = 'Rising %s '; /* used for trend arrow alt/title tags .. %s marks where value will be placed */
var langBaroFalling = 'Falling %s ';
var langBaroPerHour = '/hour.'; /* will be assembled as rising/falling + value + uom + perhour text */

var langThermoCurrently = 'Currently: '; /* used on alt/title tags for thermometer */
var langThermoMax     = 'Max: ';
var langThermoMin     = 'Min: ';

var langTempRising = 'Warmer %s '; /* used for trend arrow alt/title tags .. %s marks where value will be placed */
var langTempFalling = 'Colder %s ';
var langTempLastHour = ' than last hour.';

var langTransLookup = new Object;  // storage area for key/value for current conditions translation

var langHeatWords = new Array (
 'Unknown', 'Extreme Heat Danger', 'Heat Danger', 'Extreme Heat Caution', 'Extremely Hot', 'Uncomfortably Hot',
 'Hot', 'Warm', 'Comfortable', 'Cool', 'Cold', 'Uncomfortably Cold', 'Very Cold', 'Extreme Cold' );

// -- end of language settings ----------------------------------------------------------
When the template is using a language other than English, the language-LL.js file is loaded to override those definitions automatically. I suggest you replace the language settings section in your ajaxCUwx.js with the above and rely on the language-pl.js file to do the replacements for Polish for you.

Best regards,
Ken

Re: Now available: AJAX/PHP multilingual website templates

Posted: Sat Apr 27, 2013 1:04 pm
by Mark14
Thanks a lot, Ken :) It works.

I suggest you replace the language settings section in your ajaxCUwx.js with the above and rely on the language-pl.js file to do the replacements for Polish for you.


I replaced but now wind and barometer trend text is in English. However, I have Polish translation in language-pl.js:

Code: Select all

var langBaroTrend = new Array (
 "Stabilnie", "Ro¶nie powoli", "Ro¶nie szybko", "Spada powoli", "Spada szybko");


var langBeaufort = new Array ( /* Beaufort 0 to 12 in array */
 "Cisza", "Powiew", "Słaby wiatr", "Łagodny wiatr", "Umiarkowany wiatr", "Do¶ć silny wiatr",
 "Silny wiatr", "Bardzo silny wiatr", "Sztorm", "Silny sztorm", "Bardzo silny sztorm",
 "Gwałtowny sztorm", "Huragan"

var langHeatWords = new Array ( /* used for Heat Color Word */
 'Unknown', 'Ekstremalny upał Niebezpieczeństwo', 'Upał Niebezpieczeństwo', 'Upał Ostrzeżenie', 'Ekstremalnie gor±co', 'Niekomfortowo gor±co',
 'Gor±co', 'Ciepło', 'Komfortowo', 'Chłodno', 'Zimno', 'Niekomfortowo zimno', 'Bardzo zimno', 'Ekstremalnie zimno' );

Re: Now available: AJAX/PHP multilingual website templates

Posted: Sat Apr 27, 2013 3:15 pm
by saratogaWX
With JavaScript disabled, your site does have the PHP show the Polish words correctly.

When JavaScript is enabled, the words revert to English indicating that the language-pl.js file is not being included in your page.

Check your top.php to make sure the following code is still there

Code: Select all

  <head>
<?php if(isset($SITE['ajaxScript'])) { ?>
    <!-- ##### start AJAX mods ##### -->
    <script type="text/javascript" src="<?php echo $SITE['ajaxScript']; ?>"></script>
    <!-- AJAX updates by Ken True - http://saratoga-weather.org/wxtemplates/ -->
<?php } // end if ajaxScript ?>
<?php if (isset($showGizmo) and $showGizmo) { ?>
    <script type="text/javascript" src="ajaxgizmo.js"></script>
<?php if (isset($SITE['UV']) and !$SITE['UV']) {  // turn gizmo uv display off ?>
    <script type="text/javascript"> showUV = false; </script>
<?php   }  // end of turn gizmo uv display off ?>
<?php } // end of showGizmo ?>
<?php if (file_exists("language-". $SITE['lang'] . ".js") ) { ?>
    <script type="text/javascript" src="language-<?php echo $SITE['lang']; ?>.js"></script>
   <!-- language for AJAX script included -->
<?php } ?>


In particular, the

Code: Select all

<?php if (file_exists("language-". $SITE['lang'] . ".js") ) { ?>
    <script type="text/javascript" src="language-<?php echo $SITE['lang']; ?>.js"></script>
   <!-- language for AJAX script included -->
<?php } ?>
appears to be missing as the <script> HTML is not included on your page. The language-pl.js file does exist (and is read by the PHP to make the PHP page (without JavaScript enabled) show correctly.

Re: Now available: AJAX/PHP multilingual website templates

Posted: Sun Apr 28, 2013 7:28 am
by Mark14
Thank you for help and patience for me :) Now I have my website working well.

I can make some improvements. By the way, I found interesting site http://andretti.pl/index.php?lang=en and modified thermometer. Is there anywhere a script for Cumulus?

Re: Now available: AJAX/PHP multilingual website templates

Posted: Sun Apr 28, 2013 10:05 pm
by saratogaWX
As I remember, the original colored thermometer mods were made by Bashewa Weather for Weather-Display clientraw.txt use. I don't see a download for that on his site currently, and don't know if he ever customized it for Cumulus.

Best regards,
Ken

Re: Now available: AJAX/PHP multilingual website templates

Posted: Mon Apr 29, 2013 1:52 am
by BCJKiwi
Have posted a CU version of the Thermometer script in a separate thread http://sandaysoft.com/forum/viewtopic.php?f=25&t=9866

Re: Now available: AJAX/PHP multilingual website templates

Posted: Mon Apr 29, 2013 9:50 pm
by Mark14
Thanks for the thermometer script for Cumulus.

One more thing could be useful for me -cloudbase.php However I found the script for WeatherDisplay. There was no option to Cumulus. BCJKiwi, I see you have cloud base based on Cumulus software. Could you show me thethread with the script for Cumulus?

Re: Now available: AJAX/PHP multilingual website templates

Posted: Tue Apr 30, 2013 8:08 am
by BCJKiwi
@ Mark14,
I'll have a look at this but it is not nearly as straightforward nor as self contained as the thermometer script.

It also originally came from Bashewa but was modified buy others - all for WD - then Ray adapted it for Cumulus.
I had some difficulty getting my head around some of the settings, what they did and the terminology used.
I will check with Ray, and look at the changes need in Ajax-dashboard as well as the support folders and files before agreeing to provide the script for others. I don't like to provide source that needs support as it takes too much time and in this case, I don't understand much of the code.

Later ..... :?:

Re: Now available: AJAX/PHP multilingual website templates

Posted: Tue Apr 30, 2013 8:17 pm
by Mark14
Ok, I'll wait for modification for Cumulus. I think that also other Cumulus users will use it.

By the way, where should I change my date format into dd-MM-yyyy to have appropriate informations (for month and year) about Weather Trends on this site: http://pogodaslesin.byethost11.com/wxtrends.php?lang=en# :?: