Code Textespaņol====== Translation ======

How To Write New Language Support

Requirements

If you are going to translate Jaws into a new language there are a few things that are useful to have, although none are essential, they will make you’re job a lot easier.

  1. A highlighting code editor. While you can edit the translations in notepad, you will find it easier to use a highlighting code editor so that you can see what you’re doing clearly. They are also useful for spotting where you have made errors.
  2. Jaws SVN. If you are going to translate things, it’s best to do it for the current SVN version of Jaws so that you don’t miss any new strings that have been added since the last stable release. See the jaws:development:svn for more details.

Adding Your Language

The first step is to let Jaws know that another language has been added, to do this create a new directory in html/languages with the same name as your country code. English is en, Spanish (Espanol) is es, German (Deutsch) is de etc. You can find a full list of country codes at http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC222.

If you are writing a regional variation, such as Mexican Spanish, there may be a sub-code for you. Mexican Spanish is es_MX.

In this directory you should create a file called FullName, which contains the full name of your language to be displayed to users.

lanugages/en/FullName

International English

Finally go to the Control Panel, and check that your language appears in the language selection box, then set Jaws to use your language.

You should notice that a lot of * symbols appear next to text, this marks a string as being untranslated, and allows you to see the progress you’re making.

Starting To Translate

You should now copy languages/en/Global.php to your languages directory, so if you were doing a Spanish translation you would copy it to languages/es/Global.php

This file contains some strings that are used by most gadgets, so that they only need to be translated once, and it should look something like this:

<?php
// Global translations for commonly used strings.
// Copyright (c) 2005, Jaws
// Generated: Fri 4th March 2005, 6:30pm
 
/**
 * Meta Data
 *
 * "Project-Id-Version: Global"
 * "Last-Translator: Helgi Þormar Þorbjörnsson <dufuz@php.net>"
 * "Language-Team: EN"
 * "MIME-Version: 1.0"
 * "Content-Type: text/plain; charset=UTF-8"
 * "Content-Transfer-Encoding: 8bit"
 */
 
/* Single words */
define('_EN_GLOBAL_TITLE', "Title");
//       ^^^^^^^^^^^^^^^^   ^^^^^
//       String ID          Translation
define('_EN_GLOBAL_URL', "URL");
define('_EN_GLOBAL_SAVE', "Save {0}");
define('_EN_GLOBAL_UPDATE', "Update {0}");
define('_EN_GLOBAL_CANCEL', "Cancel");
define('_EN_GLOBAL_NAME', "Name");
define('_EN_GLOBAL_FILE', "File");
define('_EN_GLOBAL_FILENAME', "Filename");
define('_EN_GLOBAL_PROPERTIES', "Properties");
define('_EN_GLOBAL_YES', "Yes");
// There will be more down here, but I've removed them to save space.
?>

Each string identifier is built in a similar way, the _EN specifies that this is an English translation, _GLOBAL is usually the gadget the string belongs to, but in this case marks it as a global string. Anything after the second _ is used to split the ID into something readable.

Now if we look at the meta data part, it’s a crucial part.

/**
 * Meta Data
 *
 * "Project-Id-Version: Global"
                         ^^^ This is the project in question, for example Blog
 * "Last-Translator: Helgi Þormar Þorbjörnsson <dufuz@php.net>"
                     ^^^ This is the last person that translated anything in the file.
 * "Language-Team: EN"
                   ^^^ This is the language team in question
                       (and incidentally the language the translations are in)
   Everything here below should not be altered.
 
 * "MIME-Version: 1.0"
 * "Content-Type: text/plain; charset=UTF-8"
 * "Content-Transfer-Encoding: 8bit"
 */

We’re now ready to translate a string, starting with _EN_GLOBAL_TITLE. - Change _EN to your country code, such as _ES. - Change “Title” to “Titullo” (Title in Spanish, obviously this should be your languages translation) - Save the file, and check that it looks right. You can find a title header by going to the Blog gadget and starting to add a new entry.

Placeholders

You may have noticed that some of the strings contain bits like {0}, or {1}. These are placeholders where another word will be put in instead of the marker.

In most cases it’s obvious what will go in that place. “Save {0}” will be changed to “Save Page” for example if a page is being edited. When translating just put the placeholder where the word would make sense in your language.

Translating Gadgets

Translating a gadget is almost identical to translating the global strings, but the files are kept in gadgets/Blog/languages/, gadgets/Faq/languages etc.

You also don’t need to create a FullName file, since that is always read from the global translations.

Submitting Your Translation

Once you are done translating, you can submit your translation to be included in the next release of Jaws.

If you’re working with a CVS version of Jaws you can run the following command in your html/ directory:

cvs diff -u > es.diff

Which will output a file called es.diff containing a summary of all the changes you have made. You can then e-mail that to jaws-dev@forge.novell.com our translators mailing list. So long as you havn’t made any major mistakes it will probably be added to CVS shortly afterwards, and then included in any future releases of Jaws. Please make sure you also include your name in the e-mail so that we can credit you for your work.

Staying Up To Date

If you would like to be kept up to date on changes that are made please say so in your e-mail, and you’ll be added to our translators list.

This is a low traffic list which doesn’t get much mail, mostly it’s just announcements that a new release is going to be out soon, so that you know when it’s a good time to catch up on new translations.

 
  /var/www/wiki/htdocs/data/jaws/development/languages/howtowrite.txt · Last modified: 2007/11/02 16:27