Page: Program_Root/translation.str_mgmt.012.php



Classes defined on this page:
Include Statements Summary
INCLUDE TYPEINCLUDED FILENAMEDESCRIPTION
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

require_once file: "DB.php"

Additional functions for Translation class
Functions allowing user to create the new language, translation for specific strings and full management of the languages database.


Function Detail

addTranslation

integer addTranslation ( $PageID, $StringID, $String, $pear_DSN )

Translation adding
Adds string to one or more language tables.
Function Parameters:
- 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
Function Info:
Return - $result 1 if everything went OK or PEAR DB_Error object if something goes wrong

createNewLang

integer createNewLang ( $LangID, $LangName, $METATags, $pear_DSN )

New language creation
Creates 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.
Function Parameters:
- 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.
Function Info:
Return - $result 1 if everything went OK or PEAR DB_Error object if something goes wrong.

removeLang

integer removeLang ( $LangID, $pear_DSN )

Language removal
Removes 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.
Function Parameters:
- string $LangID: Language identifier
- string $pear_DSN: PEAR DSN string for database connection
Function Info:
Return - $result 1 if everything went OK or PEAR DB_Error object if something goes wrong.

removeTranslation

integer removeTranslation ( $PageID, $StringID, $pear_DSN )

Translation removal
Removes string from all of string tables
Function Parameters:
- string $PageID: page identifier.
- string $StringID: string identifier.
- string $pear_DSN: PEAR DSN string for database connection
Function Info:
Return - $result 1 if everything went OK or PEAR DB_Error object if something goes wrong