DemoList your siteSupportBugs reportContact

How can I translate Family Tree PHP?

It is easy to make a new translation for Family Tree PHP. Just open one of the language files and translate it!

You can find the language files in de folder ‘lang’. To open the English language file, open the file ‘lang/en/index.php’ in a text editor. However, there are some things you have to be careful about:

  1. The language file must be saved with utf-8 encoding without BOM. You don’t have to know what this means; you only need a text editor that can do this. Notepad++ would be a good choice.
  2. The language files contains PHP scripting. You should leave this as is and only translate the content.
  3. The language files also contain settings for data formats. You should edit these to set the right settings for your language.

PHP scripting

Most lines in the language files look like this:

define('LN_CHANGE_LANG','Change language');

You only have to translate the part in red.

Some lines contain a code beginning with %. Example:

define('LN_SEARCH_RESULT_TOTAL','Search results %d to %d from %d results.');

Here you should also only translate the parts in red en leave the ‘%d’ on the places where they should be in your language. You should also leave any html tags (anything between < and >) in place.

Some lines don’t begin with ‘define’ but contain an ‘array’.

$ln_dates = array('from','to','between','and','estimated','about','calculated','before',
'after','interpreted','circa');

Translate the parts in red.

Note: some parts are between double quotes, others between single quotes. Always end with the same as you started. Do you have to use double quotes in your translation, then start and end with single quotes. Do you have to use single quotes in your translation, then start and end with single quotes. Do you have to use both single and double quotes in your translation, then start and end with double quotes and use \” in stead of ” in your translation itself.

Date formats

The date formats are set like this:

define('LN_DATETIME_FORMAT','%B %e, %Y %H:%M:%S');

The parts in red should be ordered as they should be for you language. What these codes mean, you can find at http://www.php.net/manual/en/function.strftime.php.

Conclusion

Is all this too difficult for you? Don’t bother! Just translate and send the file to me. I will take care of the scripting part.

The new language file should be saved as ‘index.php’ in it’s own subfolder. A file for German would become ‘lang/de/index.php’.

Comments are closed.

© 2009