Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Cumulus, XML, AJAX and translations

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

ritchie
Posts: 42
Joined: Mon 02 Feb 2009 10:25 pm
Weather Station: WS 1081
Operating System: windows 10
Location: Rieti Italy

Re: Cumulus, XML, AJAX and translations

Post by ritchie »

aadal wrote:Where is link to your page en_it?
I solved the spesial norwegian characters i use:
'Waxing Crescent' => 'Voksende m&#229ne',
The weather in Oslo is on the other side of the mountains from here, but then the sun is start working longer hourer.
I think its early to bring shorts :)
Here is Weather statistics for Oslo http://www.yr.no/place/Norway/Oslo/Oslo ... stics.html
Too darn cold for me - price of flights might also put me off :|

The code for creating the translated date looks like this:

Code: Select all

<span id="#dayname" class="refresh"></span>&nbsp;<span id="#day" class="refresh"></span>&nbsp;<span id="#monthname" class="refresh">&nbsp;</span><span id="#year" class="refresh"></span>&nbsp;<span id="#hour" class="refresh"></span>:<span id="#minute" class="refresh"></span>
You need to move the individual components around to suit your own language.
My experimental page is at:
http://www.s1consulting.co.uk/weather/ajaxindex.htm
Native Italian speakers must excuse my translations, I don't know how to put some of the words into a weather context
:oops:
Image
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: Cumulus, XML, AJAX and translations

Post by aadal »

ritchie wrote:
aadal wrote:Where is link to your page en_it?
I solved the spesial norwegian characters i use:
'Waxing Crescent' => 'Voksende m&#229ne',
The weather in Oslo is on the other side of the mountains from here, but then the sun is start working longer hourer.
I think its early to bring shorts :)
Here is Weather statistics for Oslo http://www.yr.no/place/Norway/Oslo/Oslo ... stics.html
Too darn cold for me - price of flights might also put me off :|

The code for creating the translated date looks like this:

Code: Select all

<span id="#dayname" class="refresh"></span>&nbsp;<span id="#day" class="refresh"></span>&nbsp;<span id="#monthname" class="refresh">&nbsp;</span><span id="#year" class="refresh"></span>&nbsp;<span id="#hour" class="refresh"></span>:<span id="#minute" class="refresh"></span>
You need to move the individual components around to suit your own language.
My experimental page is at:
http://www.s1consulting.co.uk/weather/ajaxindex.htm
Native Italian speakers must excuse my translations, I don't know how to put some of the words into a weather context
:oops:
Thanks ritchie
I use the code but it cant take the day, strange.

Code: Select all

<span id="#dayname" class="refresh">
Cant take in cumulusdata.xml is:
Image
Give thise:
Image

:D
  • Windows Vista
Image

Image
ritchie
Posts: 42
Joined: Mon 02 Feb 2009 10:25 pm
Weather Station: WS 1081
Operating System: windows 10
Location: Rieti Italy

Re: Cumulus, XML, AJAX and translations

Post by ritchie »

Aha - I didn't realise that was how you are doing that - it's OK, but not how I intended it.
I expected to see the English in the XML file and let the php responder do the translations !

However, if you want to do it your way, we will need to change the xml header, currently it is:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
So we will need to change it so that the correct language encoding is used.
Guess what - I don't know what that is, so we will have to explore or wait until we get a kind bystander to educate us !

:geek:
Image
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: Cumulus, XML, AJAX and translations

Post by aadal »

ritchie wrote:Aha - I didn't realise that was how you are doing that - it's OK, but not how I intended it.
I expected to see the English in the XML file and let the php responder do the translations !

However, if you want to do it your way, we will need to change the xml header, currently it is:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
So we will need to change it so that the correct language encoding is used.
Guess what - I don't know what that is, so we will have to explore or wait until we get a kind bystander to educate us !

:geek:
Hi
I run local xmldata.tpl :

Code: Select all

<weatherdata>
	<item name="#time">
		<description>The current date and time</description> 			
		<value><#time></value>
		<unit></unit> 
		<image></image>
	</item>
	<item name="#day"> 
		<value><#day></value>
		<unit></unit> 
		<image></image>
		<description>The current day as a 2-digit number</description> 
	</item>
	<item name="#dayname"> 
		<value><#dayname></value>
		<unit></unit> 
		<image></image>
		<description>The current day as a word</description> 
	</item>
	<item name="#shortdayname"> 
		<value><#shortdayname></value>
		<unit></unit> 
		<image></image>
		<description>The current day as a shortened word</description> 
	</item>
	<item name="#month"> 
		<value><#month></value>
		<unit></unit> 
		<image></image>
		<description>The current month as a 2-digit number</description> 
	</item>
	<item name="#monthname"> 
		<value><#monthname></value>
		<unit></unit> 
		<image></image>
		<description>The current month as a word</description> 
	</item>
	<item name="#shortmonthname"> 
		<value><#shortmonthname></value>
		<unit></unit> 
		<image></image>
		<description>The current month as a shortened word</description> 
	</item>
	<item name="#year"> 
		<value><#year></value>
Give me at web in cumulusdata.xml :

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" ?> 
- <weatherdata>
- <item name="#time">
  <description>The current date and time</description> 
  <value>21:14 on 28 februar 2009</value> 
  <unit /> 
  <image /> 
  </item>
- <item name="#day">
  <value>28</value> 
  <unit /> 
  <image /> 
  <description>The current day as a 2-digit number</description> 
  </item>
- <item name="#dayname">
  <value>lørdag</value> 
  <unit /> 
  <image /> 
  <description>The current day as a word</description> 
  </item>
- <item name="#shortdayname">
  <value>lø</value> 
  <unit /> 
  <image /> 
  <description>The current day as a shortened word</description> 
  </item>
- <item name="#month">
  <value>02</value> 
  <unit /> 
  <image /> 
  <description>The current month as a 2-digit number</description> 
  </item>
- <item name="#monthname">
  <value>februar</value> 
  <unit /> 
  <image /> 
  <description>The current month as a word</description> 
  </item>
- <item name="#shortmonthname">
  <value>feb</value> 
  <unit /> 
  <image /> 
  <description>The current month as a shortened word</description> 
  </item>
- <item name="#year">
  <value>2009</value> 
  <unit /> 
  <image /> 
  <description>The current year as a 4-digit number</description> 
  </item>
- <item name="#shortyear">
  <value>09</value> 
  <unit /> 
  <image /> 
  <description>The current year as a 2-digit number</description> 
  </item>
- <item name="#hour">
  <value>21</value> 
  <unit /> 
  <image /> 
  <description>The current hour as a 2-digit number</description> 
  </item>
- <item name="#minute">
  <value>14</value> 
  <unit /> 
  <image /> 
  <description>The current minute as a 2-digit number</description> 
  </item>
- <item name="#date">
  <value>28.02.2009</value> 
  <unit /> 
  <image /> 
  <description>The current date</description> 
  </item>
- <item name="#forecast">
  <value>Occasional precipitation, worsening</value> 
  <unit /> 
  <image /> 
  <description>The current forecast</description> 
  </item>
- <item name="#temp">
  <value>2,7</value> 
- <unit>
- <![CDATA[ &deg;C
  ]]> 
  </unit>
  <image /> 
  <description>The outside temperature</description> 
  </item>
- <item name="#intemp">
  <value>22,3</value> 
- <unit>
- <![CDATA[ &deg;C
  ]]> 
  </unit>
  <image /> 
  <description>The inside temperature</description> 
  </item>
- <item name="#hum">
  <value>78</value> 
  <unit /> 
  <image /> 
  <description>The outside humidity</description> 
  </item>
- <item name="#inhum">
  <value>38</value> 
  <unit /> 
  <image /> 
  <description>The inside humidity</description> 
  </item>
- <item name="#press">
  <value>1000,9</value> 
  <unit>hPa</unit> 
  <image /> 
  <description>The sea level pressure</description> 
  </item>
- <item name="#presstrend">
  <value>Falling slowly</value> 
  <unit /> 
  <image /> 
  <description>The pressure trend in words</description> 
  </item>
- <item name="#presstrendval">
  <value>-0,2</value> 
  <unit>hPa</unit> 
  <image /> 
  <description>The pressure trend in figures</description> 
  </item>
- <item name="#dew">
  <value>-0,8</value> 
- <unit>
- <![CDATA[ &deg;C
  ]]> 
  </unit>
Here is some English and some Norwegian

:D
  • Windows Vista
Image

Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Cumulus, XML, AJAX and translations

Post by beteljuice »

Some 'escape' sequences are used by xml, so, because of the way you are generating your characters you may have to use:

Code: Select all

<![CDATA[
my escaped text
]]
In your xml template.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: Cumulus, XML, AJAX and translations

Post by aadal »

beteljuice wrote:Some 'escape' sequences are used by xml, so, because of the way you are generating your characters you may have to use:

Code: Select all

<![CDATA[
my escaped text
]]
In your xml template.
Thx beteljuice
I look into thise :D
  • Windows Vista
Image

Image
ritchie
Posts: 42
Joined: Mon 02 Feb 2009 10:25 pm
Weather Station: WS 1081
Operating System: windows 10
Location: Rieti Italy

Re: Cumulus, XML, AJAX and translations

Post by ritchie »

The <![CDATA[ wrapped around the output may well cure the issue, but I don't think so.
The screen that is shown looks like an interpretation made by the browser. If that browser was IE, then it will not display correctly, it will report the file as not being well-formed.

I still suspect the encoding will be the answer we need.
I guess that Cumulus is using the locale data as set in windows for the dates, hence they will always be in the laguage of the installed machine. I hadn't considered that, but it shouldn't be an issue.
Image
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: Cumulus, XML, AJAX and translations

Post by aadal »

Hi
All is fine no here.
I run Vindows Vista English but keybord in Norwegian and then some in xml file is in Norwegian.
The cumulusdata.xml give me søndag and i use the locale.inc 'søndag' => 'S&#248ndag', then on all is ok in htm file.
I tryed using lots of encoding but nothing worked out.

:D
  • Windows Vista
Image

Image
User avatar
w5afw
Posts: 154
Joined: Thu 29 Jan 2009 8:48 pm
Weather Station: ws-2315
Location: Houston, the Eagle has landed, TX
Contact:

Re: Cumulus, XML, AJAX and translations

Post by w5afw »

any ideas why the ajax template runs okay on some webservers and not others? isn't xml support pretty standard? on one server I get "unauthorized to view this url" errors and red x's on my page, even though the shell loads ok. on a different host server with the same file setup, it's all good. curious...
W5AFW, Lex

Image
ritchie
Posts: 42
Joined: Mon 02 Feb 2009 10:25 pm
Weather Station: WS 1081
Operating System: windows 10
Location: Rieti Italy

Re: Cumulus, XML, AJAX and translations

Post by ritchie »

Are you trying to access the xmlreturn.php from a different server to the one that ajaxindex.htm is on ?
That is not allowed by most browsers to stop vulnerability attacks via the web page.
The XMLHttpRequest object is subjected to the browsers security sandbox. Any resources requested by the XMLHttpRequest object must reside within the same domain from which the calling script originated. XMLHttpRequest cannot request services due to security restriction, outside the domain from which the script was originally served.
You must serve both the .htm main page and the AJAX requests that it contains from the same server.
Image
User avatar
w5afw
Posts: 154
Joined: Thu 29 Jan 2009 8:48 pm
Weather Station: ws-2315
Location: Houston, the Eagle has landed, TX
Contact:

Re: Cumulus, XML, AJAX and translations

Post by w5afw »

I understand. Actually, the file setup and all required data files are exactly mirrored on the two hosts. Have a look --

http://wxnow.comli.com/ajaxindex.htm

http://home.comcast.net/~w5afw/ajaxindex.htm
W5AFW, Lex

Image
ritchie
Posts: 42
Joined: Mon 02 Feb 2009 10:25 pm
Weather Station: WS 1081
Operating System: windows 10
Location: Rieti Italy

Re: Cumulus, XML, AJAX and translations

Post by ritchie »

If I try to access only the xmlreturn.php file directly I also get the error;
Ensure that the file is marked as executable, if in doubt, set it to 777
Image
User avatar
w5afw
Posts: 154
Joined: Thu 29 Jan 2009 8:48 pm
Weather Station: ws-2315
Location: Houston, the Eagle has landed, TX
Contact:

Re: Cumulus, XML, AJAX and translations

Post by w5afw »

that particular server does not host php; would that mean the ajax also doesn't run?
W5AFW, Lex

Image
ritchie
Posts: 42
Joined: Mon 02 Feb 2009 10:25 pm
Weather Station: WS 1081
Operating System: windows 10
Location: Rieti Italy

Re: Cumulus, XML, AJAX and translations

Post by ritchie »

yes :cry:
Image
steviegal
Posts: 19
Joined: Thu 20 Nov 2008 1:19 pm
Weather Station: Davis Vantage Pro2
Location: Dorset UK

Re: Cumulus, XML, AJAX and translations

Post by steviegal »

Hi,

I am feeling adventurous and would like to try this template, but after following instructions I don't seem to be able to display the template
on my site. My data is there OK.
I have the xmldata.tpl file in Local filenames in Cumulus Internet settings.


http://www.melburyosmond.co.uk/ajaxindex.htm

Any ideas anyone?

Steve
Image
Post Reply