Skip to content
Snippets Groups Projects
Unverified Commit 117a02ea authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Add phpdoc

parent 2cac32f5
No related branches found
No related tags found
No related merge requests found
...@@ -19,15 +19,24 @@ class Translate ...@@ -19,15 +19,24 @@ class Translate
*/ */
private $configuration; private $configuration;
/**
* Associative array of languages.
*
* @var array
*/
private $langtext = array(); private $langtext = array();
/** /**
* Associative array of dictionaries. * Associative array of dictionaries.
*
* @var array
*/ */
private $dictionaries = array(); private $dictionaries = array();
/** /**
* The default dictionary. * The default dictionary.
*
* @var array|null
*/ */
private $defaultDictionary = null; private $defaultDictionary = null;
...@@ -38,7 +47,6 @@ class Translate ...@@ -38,7 +47,6 @@ class Translate
*/ */
private $language; private $language;
/** /**
* Constructor * Constructor
* *
...@@ -66,7 +74,6 @@ class Translate ...@@ -66,7 +74,6 @@ class Translate
} }
} }
/** /**
* Return the internal language object used by this translator. * Return the internal language object used by this translator.
* *
...@@ -77,7 +84,6 @@ class Translate ...@@ -77,7 +84,6 @@ class Translate
return $this->language; return $this->language;
} }
/** /**
* This method retrieves a dictionary with the name given. * This method retrieves a dictionary with the name given.
* *
...@@ -107,7 +113,6 @@ class Translate ...@@ -107,7 +113,6 @@ class Translate
return $this->dictionaries[$name]; return $this->dictionaries[$name];
} }
/** /**
* This method retrieves a tag as an array with language => string mappings. * This method retrieves a tag as an array with language => string mappings.
* *
...@@ -145,7 +150,6 @@ class Translate ...@@ -145,7 +150,6 @@ class Translate
return $dictionary[$tag]; return $dictionary[$tag];
} }
/** /**
* Retrieve the preferred translation of a given text. * Retrieve the preferred translation of a given text.
* *
...@@ -186,7 +190,6 @@ class Translate ...@@ -186,7 +190,6 @@ class Translate
throw new \Exception('Nothing to return from translation.'); throw new \Exception('Nothing to return from translation.');
} }
/** /**
* Translate the name of an attribute. * Translate the name of an attribute.
* *
...@@ -219,7 +222,6 @@ class Translate ...@@ -219,7 +222,6 @@ class Translate
return $name; return $name;
} }
/** /**
* Mark a string for translation without translating it. * Mark a string for translation without translating it.
* *
...@@ -232,7 +234,6 @@ class Translate ...@@ -232,7 +234,6 @@ class Translate
return $tag; return $tag;
} }
/** /**
* Translate a tag into the current language, with a fallback to english. * Translate a tag into the current language, with a fallback to english.
* *
...@@ -321,7 +322,6 @@ class Translate ...@@ -321,7 +322,6 @@ class Translate
return $translated; return $translated;
} }
/** /**
* Return the string that should be used when no translation was found. * Return the string that should be used when no translation was found.
* *
...@@ -340,7 +340,6 @@ class Translate ...@@ -340,7 +340,6 @@ class Translate
} }
} }
/** /**
* Include a translation inline instead of putting translations in dictionaries. This function is recommended to be * Include a translation inline instead of putting translations in dictionaries. This function is recommended to be
* used ONLY for variable data, or when the translation is already provided by an external source, as a database * used ONLY for variable data, or when the translation is already provided by an external source, as a database
...@@ -363,7 +362,6 @@ class Translate ...@@ -363,7 +362,6 @@ class Translate
$this->langtext[$tag] = $translation; $this->langtext[$tag] = $translation;
} }
/** /**
* Include a language file from the dictionaries directory. * Include a language file from the dictionaries directory.
* *
...@@ -386,7 +384,6 @@ class Translate ...@@ -386,7 +384,6 @@ class Translate
$this->langtext = array_merge($this->langtext, $lang); $this->langtext = array_merge($this->langtext, $lang);
} }
/** /**
* Read a dictionary file in JSON format. * Read a dictionary file in JSON format.
* *
...@@ -419,7 +416,6 @@ class Translate ...@@ -419,7 +416,6 @@ class Translate
return $lang; return $lang;
} }
/** /**
* Read a dictionary file in PHP format. * Read a dictionary file in PHP format.
* *
...@@ -441,7 +437,6 @@ class Translate ...@@ -441,7 +437,6 @@ class Translate
return array(); return array();
} }
/** /**
* Read a dictionary file. * Read a dictionary file.
* *
...@@ -471,7 +466,13 @@ class Translate ...@@ -471,7 +466,13 @@ class Translate
return array(); return array();
} }
/**
* Translate a singular text.
*
* @param string $original The string before translation.
*
* @return string The translated string.
*/
public static function translateSingularGettext($original) public static function translateSingularGettext($original)
{ {
$text = \Gettext\BaseTranslator::$current->gettext($original); $text = \Gettext\BaseTranslator::$current->gettext($original);
...@@ -485,7 +486,15 @@ class Translate ...@@ -485,7 +486,15 @@ class Translate
return strtr($text, is_array($args[0]) ? $args[0] : $args); return strtr($text, is_array($args[0]) ? $args[0] : $args);
} }
/**
* Translate a plural text.
*
* @param string $original The string before translation.
* @param string $plural
* @param string $value
*
* @return string The translated string.
*/
public static function translatePluralGettext($original, $plural, $value) public static function translatePluralGettext($original, $plural, $value)
{ {
$text = \Gettext\BaseTranslator::$current->ngettext($original, $plural, $value); $text = \Gettext\BaseTranslator::$current->ngettext($original, $plural, $value);
...@@ -499,7 +508,6 @@ class Translate ...@@ -499,7 +508,6 @@ class Translate
return strtr($text, is_array($args[0]) ? $args[0] : $args); return strtr($text, is_array($args[0]) ? $args[0] : $args);
} }
/** /**
* Pick a translation from a given array of translations for the current language. * Pick a translation from a given array of translations for the current language.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment