<commit_before><?php
	/**
	 * @package toolkit
	 */
	/**
	 * The translation function accepts an English string and returns its translation
	 * to the active system language. If the given string is not available in the
	 * current dictionary the original English string will be returned. Given an optional
	 * `$inserts` array, the function will replace translation placeholders using `vsprintf()`.
	 * Since Symphony 2.3, it is also possible to have multiple translation of the same string
	 * according to the page namespace (i.e. the `value returned by `Symphony`s getPageNamespace()
	 * method). In your lang file, use the `$dictionary` key as namespace and its value as an array
	 * of context-aware translations, as shown below:
	 *
	 * $dictionary = array(
	 * 		[...]
	 * 		'Create new' => 'Translation for Create New',
	 * 		'/blueprints/datasources' => array(
	 * 			'Create new' =>
	 * 			'If we are inside a /blueprints/datasources/* page, this translation will be returned for the string'
	 * 		),
	 * 		[...]
	 *	);
	 *
	 * @see core.Symphony#getPageNamespace()
	 * @param string $string
	 *  The string that should be translated
	 * @param array $inserts (optional)
	 *  Optional array used to replace translation placeholders, defaults to NULL
	 * @return
	 *  Returns the translated string
	 */
	function __($string, $inserts=NULL) {
		return Lang::translate($string, $inserts);
	}

	/**
	 * The Lang class loads and manages languages
	 */
	Class Lang {

		/**
		 * Array of transliterations
		 * @var array
		 */
		private static $_transliterations;

		/**
		 * Code of active language
		 * @var string
		 */
		private static $_lang;

		/**
		 * Context information of all available languages
		 * @var array
		 */
		private static $_languages;

		/**
		 * Array of localized strings
		 * @var array
		 */
		private static $_dictionary;

		/**
		 * Array of localized date and time strings
		 * @var array
		 */
		private static $_datetime_dictionary;

		/**
		 * Get dictionary
		 *
		 * @return array
		 *	Return the current dictionary
		 */
		public static function Dictionary() {
			return self::$_dictionary;
		}

		/**
		 * Get languages
		 *
		 * @since Symphony 2.3
		 * @return array
		 *	Return the array of languages (both enabled and disabled)
		 */
		public static function Languages() {
			return self::$_languages;
		}

		/**
		 * Get transliterations
		 *
		 * @return array
		 *	Returns the array of transliterations
		 */
		public static function Transliterations() {
			return self::$_transliterations;
		}

		/**
		 * Initialize transliterations, datetime dictionary and languages array.
		 */
		public static function initialize() {
			self::$_dictionary = array();

			// Load default datetime strings
			if(empty(self::$_datetime_dictionary)) {
				include(LANG . '/datetime.php');

				self::$_datetime_dictionary = $datetime_strings;
			}

			// Load default transliterations<commit_msg>Improved documentation for the Lang class<commit_after><?php
	/**
	 * @package toolkit
	 */
	/**
	 * The translation function accepts an English string and returns its translation
	 * to the active system language. If the given string is not available in the
	 * current dictionary the original English string will be returned. Given an optional
	 * `$inserts` array, the function will replace translation placeholders using `vsprintf()`.
	 * Since Symphony 2.3, it is also possible to have multiple translation of the same string
	 * according to the page namespace (i.e. the `value returned by `Symphony`s getPageNamespace()
	 * method). In your lang file, use the `$dictionary` key as namespace and its value as an array
	 * of context-aware translations, as shown below:
	 *
	 * $dictionary = array(
	 * 		[...]
	 * 		'Create new' => 'Translation for Create New',
	 * 		'/blueprints/datasources' => array(
	 * 			'Create new' =>
	 * 			'If we are inside a /blueprints/datasources/* page, this translation will be returned for the string'
	 * 		),
	 * 		[...]
	 *	);
	 *
	 * @see core.Symphony#getPageNamespace()
	 * @param string $string
	 *  The string that should be translated
	 * @param array $inserts (optional)
	 *  Optional array used to replace translation placeholders, defaults to NULL
	 * @return
	 *  Returns the translated string
	 */
	function __($string, $inserts=NULL) {
		return Lang::translate($string, $inserts);
	}

	/**
	 * The Lang class loads and manages languages
	 */
	Class Lang {

		/**
		 * Array of transliterations
		 * @var array
		 */
		private static $_transliterations;

		/**
		 * Code of active language
		 * @var string
		 */
		private static $_lang;

		/**
		 * Context information of all available languages
		 * @var array
		 */
		private static $_languages;

		/**
		 * Array of localized strings
		 * @var array
		 */
		private static $_dictionary;

		/**
		 * Array of localized date and time strings
		 * @var array
		 */
		private static $_datetime_dictionary;

		/**
		 * Get the current dictionary
		 *
		 * @return array
		 *	Return the dictionary
		 */
		public static function Dictionary() {
			return self::$_dictionary;
		}

		/**
		 * Get a list of either enabled or disabled languages. Example:
		 *
		 *		array(
		 *			[...]
		 *
		 *			'en' => array(
		 *				'name' => 'English',
		 *				'handle' => 'english',
		 *				'extensions' => array()
		 *			),
		 *
		 *			'it' => array(
		 *				'name' => 'Italiano',
		 *				'handle' => 'italian',
		 *				'extensions' => array(
		 *					[...]
		 *				)
		 *			),
		 *
		 *			[...]
		 *		)
		 *
		 * @see toolkit.Lang#createLanguage()
		 * @since Symphony 2.3
		 * @return array
		 *	Return an array of languages (both enabled and disabled)
		 */
		public static function Languages() {
			return self::$_languages;
		}

		/**
		 * Get transliterations
		 *
		 * @return array
		 *	Returns the transliterations array
		 */
		public static function Transliterations() {
			return self::$_transliterations;
		}

		/**
		 * Initialize transliterations, datetime dictionary and languages array.
		 */
		public static function initialize() {
			self::$_dictionary = array();

			// Load default datetime strings
			if(empty(self::$_datetime_dictionary)) {
				include(LANG . '/datetime.php');

				self::$_datetime_dictionary = $datetime_strings;
			}

			// Load default transliterations
{'fraction_non_alphanumeric': 0.11227236737925574, 'fraction_numerical': 0.001266825019794141, 'mean_word_length': 2.8700980392156863, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4874181', 'n_tokens_mistral': 2120, 'n_tokens_neox': 1689, 'n_words': 625}