Translation
Include Statements Summary |
INCLUDE TYPE | INCLUDED FILENAME | DESCRIPTION |
---|---|---|
require_once | "DB.php" | Additional functions for Translation class |
Function Summary |
integer addTranslation ( $PageID, $StringID, $String, $pear_DSN )
Translation adding |
integer createNewLang ( $LangID, $LangName, $METATags, $pear_DSN )
New language creation |
integer removeLang ( $LangID, $pear_DSN )
Language removal |
integer removeTranslation ( $PageID, $StringID, $pear_DSN )
Translation removal |
Include Statements Detail |
require_once file: "DB.php"
Additional functions for Translation classFunctions allowing user to create the new language, translation for specific strings and full management of the languages database.
public
1.2
Function Detail |
integer addTranslation ( $PageID, $StringID, $String, $pear_DSN )
Translation addingAdds string to one or more language tables.
- string $PageID: page identifier. Might be "" if the string is to be available from any page, independendly from translation object creation parameters.
- string $StringID: string identifier. Must be unique for the same PageID and strings that were created without PageID's. This rule must be used to prevent the situation of 2 same StringID's in one Translation object.
- array $String: string array of strings - the array keys should be languages id's, the values - the sttrings in these languages - e.g.: ("en"->"English text", "pl"->"Tekst polski", ...)
- string $pear_DSN: PEAR DSN string for database connection
$result 1 if everything went OK or PEAR DB_Error object if something goes wrong
integer createNewLang ( $LangID, $LangName, $METATags, $pear_DSN )
New language creationCreates new language in the system. Creates language entry in the languages table and the table for language strings. If other languages has been created before and their tables were filled with strings, function addTranslation should be executed for each of the added strings just after calling this function and before using the Translation class for any purpose.
- string $LangID: pear_DSN PEAR DSN string for database connection
- string $LangName: Language name - it is preferred so this name should be in language, which it describes. This name can be later retrieved by calling getLangName and getOtherLangs methods and used for hyperlinks changing the site language.
- string $METATags: Tags that may describe the language codepage etc. These tags can be retrieved by calling getMetaTags method.
$result 1 if everything went OK or PEAR DB_Error object if something goes wrong.
integer removeLang ( $LangID, $pear_DSN )
Language removalRemoves language from system. This function should be used with much carefull - this will permanently remove all the strings that has been added to language table by dropping this table.
- string $LangID: Language identifier
- string $pear_DSN: PEAR DSN string for database connection
$result 1 if everything went OK or PEAR DB_Error object if something goes wrong.
integer removeTranslation ( $PageID, $StringID, $pear_DSN )
Translation removalRemoves string from all of string tables
- string $PageID: page identifier.
- string $StringID: string identifier.
- string $pear_DSN: PEAR DSN string for database connection
$result 1 if everything went OK or PEAR DB_Error object if something goes wrong