Difference between revisions of "Languages"
m (updating link since SF.net now requires the trailing slash) |
(No difference)
|
Latest revision as of 04:28, 7 August 2008
PhpGedView has built-in support for multiple languages.
Contents
Language configuration tools
You will find the tools for managing languages in the admin menu:
- Byte Order Mark (BOM) check
- Help Text Debug Option
- Language File Edit Utility
- Language File Export Utility
- Language File Comparison Utility
- PhpGedView Translations forum on SourceForge
Language encoding
PHP supports UTF-8 Unicode encoding and that is the recommended character encoding for GEDCOMs with PhpGedView. PHP does not support UTF-16 encoding. If you have characters in your GEDCOM outside the standard ASCII alphabet, you should probably use the UTF-8 encoding. There are many differences between UTF-8 and UTF-16, but anything that you can encode in UTF-16 you should be able to encode in UTF-8. It is also quite easy to convert from UTF-16 to UTF-8. Simply open your Unicode GEDCOM file in Windows Notepad and select "File->Save As.." from the menu and choose UTF-8 as the encoding option. You shouldn't lose any of the characters in the translation. Read more on UTF-8, UTF-16 and other Unicode encodings in the Wikipedia article on Unicode
Editing language files
Note: Make this a separate article
Note: If you want to use the language editing features you will need to set Write permissions for all of the files in the "languages" folder.
Discussion and questions about the multiple language features of PhpGedView, including translations, should be posted in the Translations forum available from the PhpGedView project page here: http://sourceforge.net/forum/forum.php?forum_id=294245
To translate PhpGedView into another language that is not currently supported you must first login to PhpGedView as an administrator and go to the Language Edit Utility by clicking on "Admin-> Translator Tools". At the bottom of that page is an option to Add a new language. Choose your language from the dropdown list and click on the "Add new Language" button.
A popup window will appear that allows you to edit the default settings for your language. Each of the settings has online help available by clicking on the "?". You might want to look at the settings for some of the other languages on the edit language page to see how they are set up.
When you have finished editing the settings, click the Save button. This will create a new lang_settings.php file in the index directory. You will notice that your language now appears in the supported languages list.
Next create a copy of the "configure_help.en.php", "facts.en.php", "help_text.en.php", and "lang.en.php" files located in the "languages" folder and change the "en" part to match the two letter language code of your language.
The "facts" file contains all of the translations for the various GEDCOM tags such as BIRT = Birth. The "lang" file contains all of the language variables used throughout the site. The "configure_help.en.php" and "help_text.en.php" provide configuration and help instructions.
You can translate these files using the online Language File Edit utility. Just select your language from the drop-down list and then select the file you want to edit and click the Edit button. Your file will be compared to the English language file so that you can easily translate the files online.
You can also translate these files manually by opening them in any text editor. If you manually edit the files, you must be sure to save them in the UTF-8 character set. Some text editors like Windows Notepad add a 3-byte Byte-Order-Mark (BOM) to files they save in UTF-8. PHP does not like the BOM and it should be removed before testing the files in PhpGedView. PhpGedView's Translator Tools section has a utility program to remove these BOMs.
You should obtain a flag file from http://w3f.com/gifs/index.html and size it to match the other flags in the images/flags directory.
To help maintain languages, a language change log is provided in the languages directory. This change log is named LANG_CHANGELOG.txt. All changes to the English language files are recorded here.
If you make a new translation of PhpGedView or update another translation, and would like to contribute it to the community please post your language files and your index/lang_settings.php file to the Patches section of the SourceForge project site at http://www.sourceforge.net/projects/phpgedview/
The list of language files:
- admin.xx.php This file contains terms and common expressions for use during the administration of PhpGedView and the genealogical databases.
- configure_help.xx.php This file contains terms, common expressions, and Help text for use during configuration of PhpGedView. The Help text is not intended to be viewed by ordinary users.
- countries.xx.php This is a list of country names, taken from the Web site of the Statistics Division, United Nations Department of Economic and Social Affairs. This is the relevant link to the English list. The list is available in either English or French.
- editor.xx.php This file contains terms and common expressions for use during the editing of entries in the genealogical databases.
- facts.xx.php This file contains the textual equivalents of the GEDCOM Fact codes found in the GEDCOM 5.5.1 Standard. It also contains additional Fact codes not found in the Standard but used by various genealogy programs. An English copy of the GEDCOM 5.5.1 Standard can be downloaded in PDF (Portable Document Format).
- faqlist.xx.php This file is a set of frequently asked questions that have been collected by the PhpGedView development team. Each FAQ has two entries in this file. One entry is the FAQ heading (usually the question), and the other is the FAQ body (usually the answer). Replacements for the faqlist.xx.php files, which are updated frequently, may be downloaded from the PhpGedView home site. See also Writing FAQ's in multiple languages
- help_text.xx.php This file contains Help text for ordinary users. Some Help topics in this file address the needs of Administrators, and are hidden from users who do not have Admin rights.
- lang.xx.php Many terms and common expressions are found in this file.
- extra.xx.php This file is always loaded after all the others and provides a means whereby a site administrator can override or alter any standard text in the selected language. It can also be used to provide a title for the genealogical databases that varies according to the currently active language. The contents of this additional file are completely up to the site administrator; this file will never be distributed with any version of PhpGedView. The administrator should never make changes to the standard language files; all local changes should be concentrated in this optional file.
Language extensions
Language extension files are custom PHP files that you can use to make your own language specific extensions to PhpGedView. To add a language file extension, create a new PHP file called lang.xx.extra.php [extra.xx.php for versions of PGV after 4.0] replacing the "xx" with the code for the language you want to extend. These files are not automatically included with the package so that when you upgrade, your extensions are not overwritten.
If this file exists for the language that is chosen, it is the very last thing that is loaded before the display starts. These files were designed to be language file extensions, but you could easily use them to make settings changes based on the chosen language.
What sort of things can you do with language extensions?
- Customize any of the text that appears on the site, - Change configuration options based on language, - Change to a different GEDCOM when someone views your site in a different language.
The only settings that you should not override in this file are the Privacy settings.
If, for example, you wanted to change the GEDCOM title when you changed the language, you could change the title for each language by adding the following line to your lang.xx.extra.php:
$GEDCOMS["surname.ged"]["title"] = "Title in Chinese";
In this file you could also change the text on the buttons:
$pgv_lang["view"]="Show";
With this file you could also change the GEDCOM that is displayed when the language is selected. Suppose you had a GEDCOM that was in German and one that was in English. In the lang.de.extra.php file you could add the following lines:
if ($GEDCOM=="english.ged") { header("Location: $SCRIPT_NAME?$QUERY_STRING&ged=german.ged"); exit; }
These lines say that if we are using the German language files, but are using the English GEDCOM, then we need to reload the page with the German GEDCOM. You need to reload the page so that the configuration settings for the GEDCOM get loaded. This assumes that you have both "english.ged" and "german.ged" imported into the database and that the english.ged and the german.ged have the same people in them, just in a different language.
Thus I0001 in english.ged should refer to the same I0001 in german.ged.