cloudy cloudy

Author Topic: 3in1/ plaintext description for sleet  (Read 2126 times)

0 Members and 1 Guest are viewing this topic.

Offline rh205

  • Posts: 184
  • Gosport, UK
  • OS/Browser:
  • Win NT 6.2
  • Chrome 23.0.1271.97
    • Gosport Weather
3in1/ plaintext description for sleet
« on: January 10, 2013, 11:05:24 PM »
Hi,

I have noticed that the description in the 3in1 forecast for sleet is shown as 'mix of rain and snow'. This seems to be coming from the plaintext.txt file. I was wondering if there was any way to change it to say sleet. My plaintext-parser-lang-en.txt already has 'langlookup|Rain and Snow|Sleet|', but it still says 'mix of rain and snow'. Can this be changed in anyway?

Offline ardsar

  • Posts: 127
    • Plymouth, Devon Weather, including Lightning
Re: 3in1/ plaintext description for sleet
« Reply #1 on: January 11, 2013, 11:16:44 AM »
From what I understand from the script is that no translation is required if the language is en.  Your translation file is therefore not being used and therefore changes made will have no effect on the output.  Look at the first few lines within wxall.plaintext.php and you will translation only if language <>en

What concerns me is that if the language is default at en, the script generates a lot of php warnings in an error log file on the Web host. 

Sent from my GT-I9300 using Tapatalk 2

Plymouth Weather UK, including Lightning data

www.bearsbythesea.co.uk

Offline rh205

  • Posts: 184
  • Gosport, UK
  • OS/Browser:
  • Win NT 6.2
  • Chrome 23.0.1271.97
    • Gosport Weather
Re: 3in1/ plaintext description for sleet
« Reply #2 on: January 11, 2013, 10:28:34 PM »
Hi,

I have checked wxall.plaintext.php and the language is set to 'en'.

This is a copy of the section from the wxall.plaintext.php file:

// load the config file
$config = file($plaintextfolderfull."plaintext-parser-data.txt");  //
// load and merge the language file (if it exists)
if ($lang <> 'en' and file_exists($plaintextfolderfull."plaintext-parser-lang-$lang.txt") ) {
  $doTranslate = true;
  $lfile = file($plaintextfolderfull."plaintext-parser-lang-$lang.txt");
  foreach ($lfile as $val) {
    array_push($config,$val);
  }
  $Status .= "<!-- translation file for '$lang' loaded -->\n";
  if (strpos($UTFLang,$lang) > 0) {$useCharSet = 'UTF-8'; $Status .= "<!-- using UTF-8 -->\n";}
} else {
  $doTranslate = false;
  if($lang <> 'en') {
    $Status .= "<!-- translation file for '$lang' not found -->\n";
    $lang = 'en';
  }
}

Is there any way of finding out if it is using the language file?

Offline ardsar

  • Posts: 127
    • Plymouth, Devon Weather, including Lightning
Re: 3in1/ plaintext description for sleet
« Reply #3 on: January 12, 2013, 05:13:48 PM »
Trust me it's not.  <> means "if it is anything other than en else no translation. "



Sent from my GT-I9300 using Tapatalk 2

Plymouth Weather UK, including Lightning data

www.bearsbythesea.co.uk

Offline wvdkuil

  • Wim van der Kuil
  • Posts: 1,421
  • Leuven Belgium CET
  • OS/Browser:
  • Mac OS X 10.8.2
  • Chrome 24.0.1312.52
    • My PWS at Leuven Belgium Europe
Re: 3in1/ plaintext description for sleet
« Reply #4 on: January 13, 2013, 10:06:32 AM »
. . .
I have checked wxall.plaintext.php and the language is set to 'en'.
. . .
Is there any way of finding out if it is using the language file?
Well it is not using the en language file because of the line
if ($lang <> 'en' and file_exists($plaintextfolderfull."plaintext-parser-lang-$lang.txt") ) {
which says If the language used is NOT EQUAL to english check if there is a file.
To test that it is not using any 'en' language file, simply copy the finnish language file and give it the english language file name. Now all output should be in Finnish, but when you do the test all output stays in English, not a word Finnish will appear.

The solution for you:
Because the word "frost" means something different here in continental Europe than in the US I had to change some of the English terms also. So I ran into the same problem and had to change that code line and added two other lines.
# Translations, borrowed from Ken's plaintext-parser ;)
$doTranslate = true;      // if you do not want ANY translation set to false                  #### added
// load the config file
$config = file($plaintextfolderfull."plaintext-parser-data.txt");  //
// load and merge the language file (if it exists)
#if ($lang <> 'en' and file_exists($plaintextfolderfull."plaintext-parser-lang-$lang.txt") ) {  #### commented
if ($doTranslate and file_exists($plaintextfolderfull."plaintext-parser-lang-$lang.txt") ) {    #### added

Everything works like it should be.
I enclose a zip containing an plaintext-parser-lang-en.txt with all sentences and words as I am aware off.
And a readme with more or less the same text as in this posting.

Succes, Wim
Support & demo PWS_Dasboard  (HWS_template) http://pwsdashboard.weather-template.com/ 
My PWS at home https://weer.sluispark.be/
And at my daughters house https://www.weerstation-herent.be/

 

cumulus