The language files are located in cgi-bin/languages. It is a perl executable loaded with a ‘do’ command and creates a hash containing a code used by printlang() and the string in the language selected to be returned by printlang()
The language files define values to be returned for printlang() commands. Eg. in the file fr.pl there is a line:
'Hello' => "Bonjour",
This means that the command &printlang("Hello") in the perl script will return "Bonjour" (if the current use language is fr).
You can use any name for a language you want, but I recommend using international codes like ‘en’ and ‘fr’
Function prototype: $string = printlang(code, var1,var2,…,varn); ‘code’ is the code designating the string to be returned, var1, var2, etc., are strings (may be a function that returns a string) which will replace variables in the string being returned, designated by #1, #2, etc.
printlang() will automatically use the default language. The default language is the first language in the list of languages at the top of grasshopper.pl
printlang() will search for a language cookie, and use that if it exists. The language cookie is similar to the person title cookie or the status cookie
clickable language selectors will set the language cookie and reload the page:
Multilingual template support: for a defauly template title, eg. 'page_header', create a template with that title in the DB. Then create an alternative template in the selected language, eg. 'fr_page_header'. Then point to it in the language file
'page_header' => "fr_page_header",