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
*/
private $configuration;
/**
* Associative array of languages.
*
* @var array
*/
private $langtext = array();
/**
* Associative array of dictionaries.
*
* @var array
*/
private $dictionaries = array();
/**
* The default dictionary.
*
* @var array|null
*/
private $defaultDictionary = null;
......@@ -38,7 +47,6 @@ class Translate
*/
private $language;
/**
* Constructor
*
......@@ -66,7 +74,6 @@ class Translate
}
}
/**
* Return the internal language object used by this translator.
*
......@@ -77,7 +84,6 @@ class Translate
return $this->language;
}
/**
* This method retrieves a dictionary with the name given.
*
......@@ -107,7 +113,6 @@ class Translate
return $this->dictionaries[$name];
}
/**
* This method retrieves a tag as an array with language => string mappings.
*
......@@ -145,7 +150,6 @@ class Translate
return $dictionary[$tag];
}
/**
* Retrieve the preferred translation of a given text.
*
......@@ -186,7 +190,6 @@ class Translate
throw new \Exception('Nothing to return from translation.');
}
/**
* Translate the name of an attribute.
*
......@@ -219,7 +222,6 @@ class Translate
return $name;
}
/**
* Mark a string for translation without translating it.
*
......@@ -232,7 +234,6 @@ class Translate
return $tag;
}
/**
* Translate a tag into the current language, with a fallback to english.
*
......@@ -321,7 +322,6 @@ class Translate
return $translated;
}
/**
* Return the string that should be used when no translation was found.
*
......@@ -340,7 +340,6 @@ class Translate
}
}
/**
* 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
......@@ -363,7 +362,6 @@ class Translate
$this->langtext[$tag] = $translation;
}
/**
* Include a language file from the dictionaries directory.
*
......@@ -386,7 +384,6 @@ class Translate
$this->langtext = array_merge($this->langtext, $lang);
}
/**
* Read a dictionary file in JSON format.
*
......@@ -419,7 +416,6 @@ class Translate
return $lang;
}
/**
* Read a dictionary file in PHP format.
*
......@@ -441,7 +437,6 @@ class Translate
return array();
}
/**
* Read a dictionary file.
*
......@@ -471,7 +466,13 @@ class Translate
return array();
}
/**
* Translate a singular text.
*
* @param string $original The string before translation.
*
* @return string The translated string.
*/
public static function translateSingularGettext($original)
{
$text = \Gettext\BaseTranslator::$current->gettext($original);
......@@ -485,7 +486,15 @@ class Translate
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)
{
$text = \Gettext\BaseTranslator::$current->ngettext($original, $plural, $value);
......@@ -499,7 +508,6 @@ class Translate
return strtr($text, is_array($args[0]) ? $args[0] : $args);
}
/**
* 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