Class SGL_Translation

Description

A wrapper to PEAR Translation2.

  • author: Alexander J. Tarachanowicz II <ajt@localhype.net>
  • version: $Revision: 1.0 $

Located in /SGL/Translation.php (line 49)


	
			
Method Summary
 static boolean clearCache ()
 static boolean clearGuiTranslationsCache ()
 static boolean ensureDirIsWrirable (string $dirName)
 static string escapeSingleQuote (string $string)
 static array escapeSingleQuoteInArrayKeys (array $array)
 static string extractCharset (string $lang, [string $format = SGL_LANG_ID_SGL])
 static string getCharset ([string $format = SGL_LANG_ID_SGL])
 static string getFallbackCharset ([string $format = SGL_LANG_ID_SGL])
 static string getFallbackLangID ([string $format = SGL_LANG_ID_TRANS2])
 static array getGuiTranslationsFromFile (string $module, string $lang)
 static string getLangID ([string $format = SGL_LANG_ID_TRANS2])
 static array getTranslations (string $module, string $lang, [string $fallbackLang = false])
 static boolean isAllowedLanguage (string $lang)
 static void lockTranslationFile (string $moduleName, string $lang)
 static array removeMetaData (array $aConfigs)
 static void removeTranslationLock (string $moduleName, string $lang)
 static void removeTranslationLocksByUser ( $username, string $userName)
 static boolean removeTranslations (string $moduleName)
 static object &singleton ([string $type = 'translation'], string $lang)
 static langID transformLangID (string $langID, [int $format = null])
 static boolean translationFileIsLocked (string $moduleName, string $lang)
 static boolean updateGuiTranslations (string $module, string $langID, array $aTrans)
 static array updateMetaData (array $aConfigs)
 void getFileName ( $module,  $langId, [ $path = SGL_MOD_DIR])
Methods
static clearCache (line 139)

Clear translation2 and GUI cache

  • return: true on success/false on failure
  • access: public
boolean clearCache ()
static clearGuiTranslationsCache (line 164)

Clear GUI Translations cache

  • return: true on success/false on failure
  • access: public
boolean clearGuiTranslationsCache ()
static ensureDirIsWrirable (line 708)

Ensure that target dir exist and is writable.

  • todo: move to SGL_File
boolean ensureDirIsWrirable (string $dirName)
  • string $dirName
static escapeSingleQuote (line 742)

Esacape single quote.

  • todo: move to SGL_String
string escapeSingleQuote (string $string)
  • string $string
static escapeSingleQuoteInArrayKeys (line 758)

Escape single quotes in every key of given array.

array escapeSingleQuoteInArrayKeys (array $array)
  • array $array
static extractCharset (line 431)

Get charset from supplied language.

  • access: public
string extractCharset (string $lang, [string $format = SGL_LANG_ID_SGL])
  • string $lang
  • string $format
static getCharset (line 396)

Get current charset.

  • access: public
string getCharset ([string $format = SGL_LANG_ID_SGL])
  • string $format
static getFallbackCharset (line 473)

Get default charset.

  • access: public
string getFallbackCharset ([string $format = SGL_LANG_ID_SGL])
  • string $format
static getFallbackLangID (line 456)

Get fallback language.

  • access: public
string getFallbackLangID ([string $format = SGL_LANG_ID_TRANS2])
  • string $format
static getGuiTranslationsFromFile (line 192)

Returns a dictionary of translated strings.

array getGuiTranslationsFromFile (string $module, string $lang)
  • string $module
  • string $lang
static getLangID (line 375)

Return current language ID format.

  • access: public
string getLangID ([string $format = SGL_LANG_ID_TRANS2])
  • string $format
static getTranslations (line 309)

Returns a dictionary of translated strings from the db.

array getTranslations (string $module, string $lang, [string $fallbackLang = false])
  • string $module
  • string $lang
  • string $fallbackLang
static isAllowedLanguage (line 413)

Check if language is allowed.

  • access: public
boolean isAllowedLanguage (string $lang)
  • string $lang
static lockTranslationFile (line 596)

Lock translation file.

void lockTranslationFile (string $moduleName, string $lang)
  • string $moduleName
  • string $lang
static removeMetaData (line 576)

Remove meta data from translation array.

array removeMetaData (array $aConfigs)
  • array $aConfigs
static removeTranslationLock (line 652)

Remove translation lock.

void removeTranslationLock (string $moduleName, string $lang)
  • string $moduleName
  • string $lang
static removeTranslationLocksByUser (line 673)

Remove locks set by $username.

void removeTranslationLocksByUser ( $username, string $userName)
  • string $userName
  • $username
static removeTranslations (line 513)

Remove all translations for all languages for specified module.

boolean removeTranslations (string $moduleName)
  • string $moduleName: module/page name
static singleton (line 70)

Generate singleton for PEAR::Tranlation2

Object types:

  • translation (default)
  • admin - translation2_admin
Storage drivers: (Set in global config under site)
  • single - all translations in a single table (translations)
  • multiple (default) - all translations in a seperate table
(translation_en, translation_pl, translation_de)

  • return: Translation2 object
  • access: public
object &singleton ([string $type = 'translation'], string $lang)
  • string $lang: language to return translations
  • string $type: type of object: translation or admin
static transformLangID (line 490)

Toggle langID format

SGL_LANG_ID_SGL - en-iso-8859-15 SGL_LANG_ID_TRANS2 - en_iso_8859_15

  • return: string
langID transformLangID (string $langID, [int $format = null])
  • string $langID: langID language id
  • int $format: format language id format
static translationFileIsLocked (line 624)

Check if translation is locked.

boolean translationFileIsLocked (string $moduleName, string $lang)
  • string $moduleName
  • string $lang
static updateGuiTranslations (line 251)

Update GUI Translations.

  • return: true on success and PEAR Error on failure
boolean updateGuiTranslations (string $module, string $langID, array $aTrans)
  • array $aTrans: hash containing tranlsations to be updated
  • string $langID: language id
  • string $module: module
static updateMetaData (line 550)

Add/update meta keys to translation array.

array updateMetaData (array $aConfigs)
  • array $aConfigs
getFileName (line 292)
void getFileName ( $module,  $langId, [ $path = SGL_MOD_DIR])
  • $module
  • $langId
  • $path

Documentation generated on Tue, 23 Feb 2010 18:14:33 +0000 by phpDocumentor 1.4.3