PHP Weather Home Page

Translation

As you have no doubt noticed, PHP Weather has been translated into several different languages. I'm very grateful to all who have contribuated by doing this - see the AUTHORS-file for details.

To use a translation, you only have to include the associated locale_??.inc-file. Here ?? should be substituted with the language-code of the country in question. So, to have the weather written in first in English and then in Norwegian, just execute the following code:

<?php
include('locale_en.inc');
include(
'phpweather.inc');
pretty_print_metar(get_metar('EKYT'), 'Aalborg, Denmark');
include(
'locale_no.inc');
pretty_print_metar(get_metar('EKYT'), 'Aalborg, Denmark');
?>

If you want to do a translation, then follow these steps:

  1. You'll need something to translate :-) You can use any of the already-made translations as a template, so pick one. The English translation is the original.

  2. Make a copy of your chosen template, and rename it locale_??.inc, where ?? is the normal abbreviation for your country, eg. dk for Denmark, en for England etc.

  3. Change the name of the author and email-address to you name and email-address.

  4. Here comes the difficult part: translate every string in the file, but leave the %s intact. It is these codes that will be replaced by the actual numbers and strings when the script is executed.

    Here's an example: "<b>%s</b> mm (<b>%s</b> inches)" becomes "<b>12.7</b> mm (<b>0.5</b> inches)". This string is then used in the next piece: "There was %s of precipitation", which then becomes "There was <b>12.7</b> mm (<b>0.5</b> inches) of precipitation". I hope you get the idea.

  5. Remember to translate all special characters (things like å, ü, ó etc) to their html-entities.

  6. When you're done, and have tested your translation, send it to the phpweather-devel mailinglist at SourceForge. Someone will then put it into CVS and it will be included in the next release.

Good luck on translating PHP Weather! Here's your chance to help me out - you don't have to know anything about the code to contribute, and it's a great way to tell me, that you like the script.


PHP Weather Logo SourceForge Logo