XarayaTranslationMemory  1.6
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
TranslationExportXaraya Class Reference
Inheritance diagram for TranslationExportXaraya:
ITranslationExport TranslationExportXarigami

Public Member Functions

 __construct ()
 
 FixEntity ($text)
 
 Export ($localeName, $silentMode=false)
 

Protected Attributes

 $ProjectName = "Xaraya"
 
 $XmlNameSpace = "http://xaraya.com/2002/ns/translations"
 

Private Member Functions

ExportProject (TranslationProject $project)
 
 ProcessRecursive ($dir, ProjectIterator $projectIterator)
 
 CheckCodeFiles (TranslationProject $project)
 
 LogError ($msg)
 

Private Attributes

 $RootTimeStamp
 
 $SilentMode
 
 $ErrorLogFile
 
 $XarayaRoot
 

Detailed Description

Recreates the Xaraya locale files from the database

Does exactly the opposite than TranslationImportXaraya. Note, that dead projects won't be exported.

Exporting will try to find corresponding php/xt/xd files for the created XML files and write a note to xartm_errors.txt if no corresponding code file can be found. Unless you know the purpose of the reported XML file (e.g. it's a module you currently did not install to the export directory's Xaraya), you should delete those .xml files.

Definition at line 34 of file TranslationExportXaraya.php.

Constructor & Destructor Documentation

◆ __construct()

TranslationExportXaraya::__construct ( )

Definition at line 51 of file TranslationExportXaraya.php.

Member Function Documentation

◆ CheckCodeFiles()

TranslationExportXaraya::CheckCodeFiles ( TranslationProject  $project)
private

Check if corresponding Xaraya code files for a translation file still exists.

Writes to $this->ErrorLogFile if file not found. Note: some locale files don't have a Xaraya code file (e.g. fuzzy, core, common) so they are ignored by this check.

Parameters
$projectWhich project's orignial Xaraya file to check.

Definition at line 209 of file TranslationExportXaraya.php.

References ProjectIterator\$ProjectList, TranslationProject\GetID(), TranslationProject\GetLocaleID(), TranslationProject\GetName(), and LogError().

Referenced by ProcessRecursive().

◆ Export()

TranslationExportXaraya::Export (   $localeName,
  $silentMode = false 
)

Export finished Xaraya translations of the selected locale into the selected directory.

Exporting will process all projects in the given locale's Xaraya root, create a language pack directory strucure on the $CONFIG configured destination.

Parameters
$localeNamestring Name of the locale to be exported (e.g. "hu_HU.utf-8").
$silentModebool true value suppresses all output messages.

Implements ITranslationExport.

Definition at line 328 of file TranslationExportXaraya.php.

References TranslationProject\$LocaleIDCache, ProjectIterator\ClearCache(), GetConfigVar(), and ProcessRecursive().

◆ ExportProject()

& TranslationExportXaraya::ExportProject ( TranslationProject  $project)
private

Export the translation strings of one project and return as updated document xml string.

Gets the passed project's strings from the database and puts them in the project's $Skeleton document, returns the resulting string.

Parameters
$projectThe TranslationProject to created exported XML file for.
Returns
string The resulting translated XML document.

Definition at line 64 of file TranslationExportXaraya.php.

References FixEntity(), TranslationProject\GetID(), and TranslationProject\GetSkeleton().

Referenced by ProcessRecursive().

◆ FixEntity()

TranslationExportXaraya::FixEntity (   $text)

Fix string for using in XML output. This may need changes with other DOMDocument versions.

Becuase the current domdocument actions look broken, thus we need to fix some things here.

Parameters
$textThe text to escape.
Returns
string: The escaped text &,<,>," replaced with entities.

Definition at line 120 of file TranslationExportXaraya.php.

Referenced by ExportProject().

◆ LogError()

TranslationExportXaraya::LogError (   $msg)
private

Write one message to the error log file.

Definition at line 313 of file TranslationExportXaraya.php.

Referenced by CheckCodeFiles().

◆ ProcessRecursive()

TranslationExportXaraya::ProcessRecursive (   $dir,
ProjectIterator  $projectIterator 
)
private

Create directories and translated files according to the project tree and strings database.

Calls ->ExportProject() on all translation projects recurisvely from the given root. This is a recursive function which calls itself for subdirectories.

Parameters
$dirString, the directory where the subdirectories and files should be created.
$projectIteratorThe iterator initialized with the root project from where we export.

Definition at line 138 of file TranslationExportXaraya.php.

References CheckCodeFiles(), ExportProject(), ProjectIterator\getChildren(), and ProjectIterator\hasChildren().

Referenced by Export().

Member Data Documentation

◆ $ErrorLogFile

TranslationExportXaraya::$ErrorLogFile
private

Write errors to this file, xartm_errors.txt in locale's root.

Definition at line 46 of file TranslationExportXaraya.php.

◆ $ProjectName

TranslationExportXaraya::$ProjectName = "Xaraya"
protected

Definition at line 36 of file TranslationExportXaraya.php.

◆ $RootTimeStamp

TranslationExportXaraya::$RootTimeStamp
private

Timestamp of the root project, older projects won't be exported as they are consdered to be dead projects

Definition at line 40 of file TranslationExportXaraya.php.

◆ $SilentMode

TranslationExportXaraya::$SilentMode
private

Supress all messages while exporting?

Definition at line 43 of file TranslationExportXaraya.php.

◆ $XarayaRoot

TranslationExportXaraya::$XarayaRoot
private

Root folder of Xaraya install (../../ from locale) for code file existance checking.

Definition at line 49 of file TranslationExportXaraya.php.

◆ $XmlNameSpace

TranslationExportXaraya::$XmlNameSpace = "http://xaraya.com/2002/ns/translations"
protected

Definition at line 37 of file TranslationExportXaraya.php.


The documentation for this class was generated from the following file: