Skip to content
Snippets Groups Projects
Commit 907592c7 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fixes for lib/SimpleSAML/Locale

parent b7306fa8
No related branches found
No related tags found
No related merge requests found
...@@ -196,6 +196,7 @@ class Language ...@@ -196,6 +196,7 @@ class Language
* *
* @param string $language Language code for the language to set. * @param string $language Language code for the language to set.
* @param boolean $setLanguageCookie Whether to set the language cookie or not. Defaults to true. * @param boolean $setLanguageCookie Whether to set the language cookie or not. Defaults to true.
* @return void
*/ */
public function setLanguage($language, $setLanguageCookie = true) public function setLanguage($language, $setLanguageCookie = true)
{ {
...@@ -255,7 +256,7 @@ class Language ...@@ -255,7 +256,7 @@ class Language
* *
* @param string $code The ISO 639-2 code of the language. * @param string $code The ISO 639-2 code of the language.
* *
* @return string The localized name of the language. * @return string|null The localized name of the language.
*/ */
public function getLanguageLocalizedName($code) public function getLanguageLocalizedName($code)
{ {
...@@ -281,8 +282,8 @@ class Language ...@@ -281,8 +282,8 @@ class Language
/** /**
* This method returns the preferred language for the user based on the Accept-Language HTTP header. * This method returns the preferred language for the user based on the Accept-Language HTTP header.
* *
* @return string The preferred language based on the Accept-Language HTTP header, or null if none of the languages * @return string|null The preferred language based on the Accept-Language HTTP header,
* in the header is available. * or null if none of the languages in the header is available.
*/ */
private function getHTTPLanguage() private function getHTTPLanguage()
{ {
...@@ -334,7 +335,8 @@ class Language ...@@ -334,7 +335,8 @@ class Language
/** /**
* Return an alias for a language code, if any. * Return an alias for a language code, if any.
* *
* @return string The alias, or null if the alias was not found. * @param string $langcode
* @return string|null The alias, or null if the alias was not found.
*/ */
public function getLanguageCodeAlias($langcode) public function getLanguageCodeAlias($langcode)
{ {
...@@ -399,6 +401,7 @@ class Language ...@@ -399,6 +401,7 @@ class Language
* specified is not in the list of available languages, or the headers have already been sent to the browser. * specified is not in the list of available languages, or the headers have already been sent to the browser.
* *
* @param string $language The language set by the user. * @param string $language The language set by the user.
* @return void
*/ */
public static function setLanguageCookie($language) public static function setLanguageCookie($language)
{ {
......
...@@ -132,6 +132,7 @@ class Localization ...@@ -132,6 +132,7 @@ class Localization
* *
* @param string $module Module name * @param string $module Module name
* @param string $localeDir Absolute path if the module is housed elsewhere * @param string $localeDir Absolute path if the module is housed elsewhere
* @return void
*/ */
public function addModuleDomain($module, $localeDir = null) public function addModuleDomain($module, $localeDir = null)
{ {
...@@ -148,6 +149,7 @@ class Localization ...@@ -148,6 +149,7 @@ class Localization
* *
* @param string $localeDir Location of translations * @param string $localeDir Location of translations
* @param string $domain Domain at location * @param string $domain Domain at location
* @return void
*/ */
public function addDomain($localeDir, $domain) public function addDomain($localeDir, $domain)
{ {
...@@ -156,7 +158,7 @@ class Localization ...@@ -156,7 +158,7 @@ class Localization
$this->loadGettextGettextFromPO($domain); $this->loadGettextGettextFromPO($domain);
} }
/* /**
* Get and check path of localization file * Get and check path of localization file
* *
* @param string $domain Name of localization domain * @param string $domain Name of localization domain
...@@ -205,6 +207,7 @@ class Localization ...@@ -205,6 +207,7 @@ class Localization
/** /**
* Setup the translator * Setup the translator
* @return void
*/ */
private function setupTranslator() private function setupTranslator()
{ {
...@@ -221,6 +224,7 @@ class Localization ...@@ -221,6 +224,7 @@ class Localization
* *
* @param string $domain Name of domain * @param string $domain Name of domain
* @param boolean $catchException Whether to catch an exception on error or return early * @param boolean $catchException Whether to catch an exception on error or return early
* @return void
* *
* @throws \Exception If something is wrong with the locale file for the domain and activated language * @throws \Exception If something is wrong with the locale file for the domain and activated language
*/ */
...@@ -268,6 +272,7 @@ class Localization ...@@ -268,6 +272,7 @@ class Localization
/** /**
* Set up L18N if configured or fallback to old system * Set up L18N if configured or fallback to old system
* @return void
*/ */
private function setupL10N() private function setupL10N()
{ {
......
...@@ -119,7 +119,7 @@ class Translate ...@@ -119,7 +119,7 @@ class Translate
* @param string $tag The tag name. The tag name can also be on the form '{<dictionary>:<tag>}', to retrieve a tag * @param string $tag The tag name. The tag name can also be on the form '{<dictionary>:<tag>}', to retrieve a tag
* from the specific dictionary. * from the specific dictionary.
* *
* @return array An associative array with language => string mappings, or null if the tag wasn't found. * @return array|null An associative array with language => string mappings, or null if the tag wasn't found.
*/ */
public function getTag($tag) public function getTag($tag)
{ {
...@@ -252,6 +252,8 @@ class Translate ...@@ -252,6 +252,8 @@ class Translate
* @param array $replacements An associative array of keys that should be replaced with values in the * @param array $replacements An associative array of keys that should be replaced with values in the
* translated string. * translated string.
* @param boolean $fallbackdefault Default translation to use as a fallback if no valid translation was found. * @param boolean $fallbackdefault Default translation to use as a fallback if no valid translation was found.
* @param array $oldreplacements
* @param bool $striptags
* @deprecated Not used in twig, gettext * @deprecated Not used in twig, gettext
* *
* @return string The translated tag, or a placeholder value if the tag wasn't found. * @return string The translated tag, or a placeholder value if the tag wasn't found.
...@@ -285,7 +287,7 @@ class Translate ...@@ -285,7 +287,7 @@ class Translate
); );
// for backwards compatibility // for backwards compatibility
if (!$replacements && $this->getTag($tag) === null) { if (!$replacements && ($this->getTag($tag) === null)) {
\SimpleSAML\Logger::warning( \SimpleSAML\Logger::warning(
'Code which uses $fallbackdefault === FALSE should be updated to use the getTag() method instead.' 'Code which uses $fallbackdefault === FALSE should be updated to use the getTag() method instead.'
); );
...@@ -349,6 +351,7 @@ class Translate ...@@ -349,6 +351,7 @@ class Translate
* @param array|string $translation The translation array * @param array|string $translation The translation array
* *
* @throws \Exception If $translation is neither a string nor an array. * @throws \Exception If $translation is neither a string nor an array.
* @return void
*/ */
public function includeInlineTranslation($tag, $translation) public function includeInlineTranslation($tag, $translation)
{ {
...@@ -370,6 +373,7 @@ class Translate ...@@ -370,6 +373,7 @@ class Translate
* one provided in the constructor to be used to find the directory of the dictionary. This allows to combine * one provided in the constructor to be used to find the directory of the dictionary. This allows to combine
* dictionaries inside the SimpleSAMLphp main code distribution together with external dictionaries. Defaults to * dictionaries inside the SimpleSAMLphp main code distribution together with external dictionaries. Defaults to
* null. * null.
* @return void
*/ */
public function includeLanguageFile($file, $otherConfig = null) public function includeLanguageFile($file, $otherConfig = null)
{ {
......
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