|
|||||||
1. Introduction
2. Installing Karrigell 3. The Web server 4. Configuration options 5. Working with Apache, LightTPD or Xitami 6. Programming 7. Debugging 8. Python scripts 9. CGI scripts 10. Karrigell Services 11. Python Inside HTML 12. HTML Inside Python 13. HTMLTags - generate HTML in Python 14. Including documents 15. Sessions 16. Authentication 17. Translation and Unicode 17.1 Translation 17.2 Unicode support |
17. Internationalization and UnicodeAs you'll have guessed by reading this documentation, I'm not from an English-speaking country (I'm French, and more precisely Breton - the name Karrigell is a Breton word). So I've included a program to facilitate internationalization of scripts 17.1 TranslationIn a script, every time you want a message translated into a given language, instead of writing it as a normal string with quotes, it's written using a function called _, this way :
In Python Inside HTML (PIH) you can use the shortcut <%_ > :
Karrigell provides a simple web interface to create and modify translations of
strings. For security reasons, the script that manages translation is reserved to
the administrator. An authentication script is run, relying on md5 digests stored
in a file called With your browser, call the script Fill in the fields and validate the form ; this creates or updates the translations
You can check the effect by calling the script you've just modified and changing the language order in the preferences Translation is held in a file which is common to all the files in the same directory. You can also edit the whole dictionary clicking on the first item in the script list
17.2 Unicode supportNew in version 2.2.2mostly written by Radovan GarabikUnicode is a normalized standard used to represent all the writing styles in the world. For each sign (a letter in any alphabet, an ideogram in an Asiatic language) Unicode defines a unique number, called a "code point". Since computers and networks can only manage bytes, a mapping between "code points" and one or several bytes must be defined ; these mappings are called "encodings" Because there are many different encodings, when a program has to print a sign (a greek letter, a math symbol, a Chinese sign) it must receive two pieces of information : the string representing the sign (a sequence of bytes) and the encoding used. If it receives only a string, the program can try to guess an encoding (this is what a web browser usually does) but with no guarantee of success Karrigell defines two parameters in the configuration file to handle Unicode :
(1) On Microsoft Internet Explorer the language preference is set by Tools/Internet Options/General/Languages ; accepted languages are chosen from a list and ordered by preference. On Firefox use Edition/Preferences/Languages |