Update of /cvsroot/phpweather/phpweather/docs/src/latex In directory usw-pr-cvs1:/tmp/cvs-serv24955 Added Files: installation.tex translation.tex Log Message: Just a couple of chapters... If anybody wants to write something for the manual, feel free. I'll probably do some writing myself on my holiday, but that shouldn't keep anybody from doing so also. Also, feel free to correct my grammatical mistakes and my spelling. --- NEW FILE --- \chapter{Installation} It's quite easy to install \phpw. All you have to do, is to unpack the compressed file you've downloaded from \url{http://www.sourceforge.net/phpweather/} in a directory on the webserver. Once that is done you can load the file \filename{demo.php} in your favorite browser. You should see a page that lets you chose a country with an airport that makes a METAR. There is about 3,000 airports in 192 countries that make a METAR each hour so the chance of finding one near your is rather good. \section{Further Tweaking} What you've just seen is \phpw in it's default form. You can (and should) change a couple of things. You use the Configurator to do the --- you've guessed it --- configuration. So load the file called \filename{configurator.php} and see what happens. You should be presented with a page with a lot of drop-down boxed that let you choose numerous things. If you can, you should use the Configurator to configure \phpw as it will ensure that you select valid options. \section{Database Setup} To use a MySQL database, you should create a table with the following SQL-statement: \begin{verbatim} CREATE TABLE metars ( metar VARCHAR(255) NOT NULL, timestamp TIMESTAMP(14), station VARCHAR(4) NOT NULL, PRIMARY KEY (station), UNIQUE station (station) ); \end{verbatim} If you're using a PostgreSQL database, you should use this statement instead: \begin{verbatim} CREATE TABLE metars ( metar VARCHAR(255) NOT NULL, timestamp TIMESTAMP, station VARCHAR(4) PRIMARY KEY NOT NULL ); \end{verbatim} --- NEW FILE --- \chapter{Translation} It is quite easy to translate \phpw into another language. This chaper will teach you how. \section{The Locales} All the words and sentences used by \phpw is stored in special files called \emph{locales}. You'll find these files in the directory \filename{PHPWEATHER_BASE_DIR/locales}. Each file has a name like this \filename{locale_xx.php} where \filename{xx} corrosponds to a language-code found in \filename{PHPWEATHER_BASE_DIR/db/files/countries.php}. So the Danish translation is called \filename{locale_db.php}, the Hungarian is called \filename{locale_hu.php}, etc. \section{Making a New Locale} To translation \phpw into a new language you have to make a new locale. This is done by following these steps: \begin{enumerate} \item You'll need something to translate :-) You can use any of the existing locales as a template, so pick one. It is easies to chose a language that is ``close'' to your own, but any locale will do. The English translation is the original. \item Copy your chosen locale, and rename it according to your country-code. \item Change the top of the locale so that it looks like this: \begin{verbatim} <?php /* This code makes sure that the file is only included once. */ if (defined('LOCALE_XX')) { return; } else { define('LOCALE_XX', true); } require(PHPWEATHER_BASE_DIR . '/locales/locale_common.php'); /** * Provides all the strings needed by locale_common to * produce xx-ish output. * * @author Foo Bar <[EMAIL PROTECTED]> * @link http://www.some.place.com A description of * the page you've chosen to link to. * @version $Id: translation.tex,v 1.1 2001/07/18 10:38:22 gimpster Exp $ */ class locale_xx extends locale_common { \end{verbatim} This involves \begin{enumerate} \item Changing the lines that defines the constant \code{LOCALE\_EN} so that it defines \code{LOCALE\_XX} instead. \item Changing the comment from talking about English output to your native tounge. \item Changing the name and email address of the author to your name and email-address. \item If you want, you can make a link to a page of your choice --- perhaps your homepage? \item Although not stricly necessary, you might change the line with \code{\$Id: translation.tex,v 1.1 2001/07/18 10:38:22 gimpster Exp $Id: translation.tex,v 1.1 2001/07/18 10:38:22 gimpster Exp $}. \item Changing the line with \code{class locale\_en} into \code{class locale\_xx} instead. \end{enumerate} \item Here comes the difficult part: Translate every string in the file, but leave all occurrences of \code{\%s} intact. It is these codes that will be replaced by the actual numbers and strings when \phpw is executed. Here's an example: \code{\%s mm (\%s inches)} becomes ``12.7 mm (0.5 inches)''. This string is then used in the next piece: \code{There was \%s of precipitation}, which then becomes ``There was 12.7 mm (0.5 inches) of precipitation''. I hope you get the idea. \item Remember to translate all special charecters (things like \ae, \'e, \aa, etc) to their HTML-entities. \item When you're done, and have tested your translation, send it to the maillinglist at \email{[EMAIL PROTECTED]}. Then it will be included in the tarball as soon as possible by me or someone else. \end{enumerate} That's it --- you've now translated \phpw! \section{Going Further} Now that you've made the translation you might want to refine it a little. The strings you've translated were originally English, so it might not have been easy for you to make a good translation. But what if you could change the strings completely? The good news is: ``You can!'' Now that \phpw uses objects it's possible for the translator to change almost every aspect of the translation. This can be done, because the translation you've made is the definition of a class called \class{locale\_xx} where \code{xx} is the country-code. To be continued\ldots _______________________________________________ PHPWeather-checkins mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/phpweather-checkins