Elgg  Version master
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Elgg\I18n\ReleaseCleaner Class Reference

Removes invalid language files from an installation. More...

Public Member Functions

 __construct (array $codes=[])
 Constructor. More...
 
 cleanInstallation (string $dir)
 Clean up within an installation. More...
 
 cleanLanguagesDir (string $dir)
 Clean up a languages dir. More...
 

Public Attributes

 $log = []
 

Protected Member Functions

 cleanupMissingTranslationParameters (string $directory, string $language_code)
 Try to cleanup translations with a different argument count than English as this can cause failed translations. More...
 
 cleanupEmptyTranslations (string $translation_file)
 Remove empty translations from a translation file. More...
 
 normalizeLanguageCode (string $code)
 Normalize a language code (e.g. More...
 
 detectAdditionalKeys (string $directory, string $language_code)
 Detect translation keys that (still) exist in a translation but no longer in the English translation. More...
 
 detectIdenticalTranslations (string $directory, string $language_code)
 Detect identical translations, this could be due to a wrong Transifex import. More...
 

Detailed Description

Removes invalid language files from an installation.

Definition at line 14 of file ReleaseCleaner.php.

Constructor & Destructor Documentation

Elgg\I18n\ReleaseCleaner::__construct ( array  $codes = [])

Constructor.

Parameters
string[]$codes Valid language codes

Definition at line 31 of file ReleaseCleaner.php.

Member Function Documentation

Elgg\I18n\ReleaseCleaner::cleanInstallation ( string  $dir)

Clean up within an installation.

Parameters
string$dirThe installation dir
Returns
void

Definition at line 46 of file ReleaseCleaner.php.

Elgg\I18n\ReleaseCleaner::cleanLanguagesDir ( string  $dir)

Clean up a languages dir.

Parameters
string$dirLanguages dir
Returns
void

Definition at line 83 of file ReleaseCleaner.php.

Elgg\I18n\ReleaseCleaner::cleanupEmptyTranslations ( string  $translation_file)
protected

Remove empty translations from a translation file.

Parameters
string$translation_filepath to the translation file
Returns
void

Definition at line 169 of file ReleaseCleaner.php.

Elgg\I18n\ReleaseCleaner::cleanupMissingTranslationParameters ( string  $directory,
string  $language_code 
)
protected

Try to cleanup translations with a different argument count than English as this can cause failed translations.

Parameters
string$directoryLanguage directory to use for the English translation
string$language_codeLanguage core to try to cleanup
Returns
void

Definition at line 127 of file ReleaseCleaner.php.

Elgg\I18n\ReleaseCleaner::detectAdditionalKeys ( string  $directory,
string  $language_code 
)
protected

Detect translation keys that (still) exist in a translation but no longer in the English translation.

Parameters
string$directoryDirectory to read translation from
string$language_codeTranslation to compare to English
Returns
void

Definition at line 214 of file ReleaseCleaner.php.

Elgg\I18n\ReleaseCleaner::detectIdenticalTranslations ( string  $directory,
string  $language_code 
)
protected

Detect identical translations, this could be due to a wrong Transifex import.

Parameters
string$directoryDirectory to read translation from
string$language_codeTranslation to compare to English
Returns
void

Definition at line 235 of file ReleaseCleaner.php.

Elgg\I18n\ReleaseCleaner::normalizeLanguageCode ( string  $code)
protected

Normalize a language code (e.g.

from Transifex)

Parameters
string$codeLanguage code
Returns
string

Definition at line 201 of file ReleaseCleaner.php.

Member Data Documentation

Elgg\I18n\ReleaseCleaner::$log = []

Definition at line 24 of file ReleaseCleaner.php.


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