Smart.Framework Logo

interface \SmartInterfaceAdapterTextTranslations
{ } ^::

Abstract Inteface Smart Adapter Text Translations


interface Methods

abstract public static function getTranslationsVersion ( ) {} :: 
Get Regional Text containing the Latest Version of the Translations
This function must implement a way to get last version string to validate Text Translations.
If a version cannot be provided, must return (string) date('Y-m-d') and this way the texts persistent cache will be re-validated daily.
If a real version can be provided it is the best, so persistent cache would be re-validated just upon changes !
RETURN: a non-empty string the provides the latest version string of the current texts translations
abstract public static function getTranslationsFromSource ( string $the_lang, string $y_area, string $y_subarea ) {} :: 
Get Regional Text Translation from Source by: Language, Area, Subarea
This function must implement a Text Translations parser.
It can be implemented to read from one of the variety of sources: Arrays, INI, YAML, XML, JSON, SQLite, PostgreSQL, MySQL, MongoDB, GetText, ...
RETURN: an associative array as [key => value] for the specific translation set
abstract public static function setTranslationsKeyUsageCount ( string $the_lang, string $y_area, string $y_subarea, string $y_textkey ) {} :: 
Register the usage (increment counter or register in logs) for a Regional Text Translation into Source or alternate source by: Language, Area, Subarea, Key
This function must implement a way to increment or register the usage of every used pair of Language/Area/Subarea/Key as it was used to help the cleanup of unused translations.
This function will operate only in DEV mode only (SmartEnvironment::ifDevMode() === true) ; for filesystem based adapters must also set in init.php: const SMART_FRAMEWORK__DEBUG__TEXT_TRANSLATIONS = true;
It can be implemented to write into one of the variety of sources: Text/CSV, Database, ...
RETURN: N/A

interface Properties


interface Constants



documentation generated on: 2023-10-19 23:15:49 +0000


Smart.Framework © 2009-2023 unix-world.org