X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FL10n.php;h=f7ed9918ce7bd8feb139774ab2676074aed1aff9;hb=64847e7cc8ca8f157cae4994c71b93df28624d6f;hp=2fcf6bf44a3067a92ebc32c33af53814d6de812e;hpb=33f7fd72ca1991cb46c464e735fe5c165097f64b;p=friendica.git diff --git a/src/Core/L10n.php b/src/Core/L10n.php index 2fcf6bf44a..f7ed9918ce 100644 --- a/src/Core/L10n.php +++ b/src/Core/L10n.php @@ -74,7 +74,7 @@ class L10n extends BaseObject } } } - //if $_GET['lang'] is set force $_GET['lang'] + if (isset($_GET['lang'])) { $_SESSION['language'] = $_GET['lang']; } @@ -90,6 +90,7 @@ class L10n extends BaseObject /** * @brief Returns the preferred language from the HTTP_ACCEPT_LANGUAGE header * @return string The two-letter language code + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function detectLanguage() { @@ -113,10 +114,11 @@ class L10n extends BaseObject } } } - //if $_GET['lang'] is set force $_GET['lang'] + if (isset($_GET['lang'])) { $lang_list = [$_GET['lang']]; } + // check if we have translations for the preferred languages and pick the 1st that has foreach ($lang_list as $lang) { if ($lang === 'en' || (file_exists("view/lang/$lang") && is_dir("view/lang/$lang"))) { @@ -140,9 +142,10 @@ class L10n extends BaseObject * * If called repeatedly, it won't save the translation strings again, just load the new ones. * - * @see popLang() + * @see popLang() * @brief Stores the current language strings and load a different language. * @param string $lang Language code + * @throws \Exception */ public static function pushLang($lang) { @@ -186,6 +189,7 @@ class L10n extends BaseObject * Uses an App object shim since all the strings files refer to $a->strings * * @param string $lang language code to load + * @throws \Exception */ private static function loadTranslationTable($lang) { @@ -268,8 +272,9 @@ class L10n extends BaseObject * * @param string $singular * @param string $plural - * @param int $count + * @param int $count * @return string + * @throws \Exception */ public static function tt($singular, $plural, $count) { @@ -313,6 +318,9 @@ class L10n extends BaseObject /** * Provide a fallback which will not collide with a function defined in any language file + * + * @param int $n + * @return bool */ private static function stringPluralSelectDefault($n) { @@ -390,7 +398,8 @@ class L10n extends BaseObject * Load poke verbs * * @return array index is present tense verb - * value is array containing past tense verb, translation of present, translation of past + * value is array containing past tense verb, translation of present, translation of past + * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @hook poke_verbs pokes array */ public static function getPokeVerbs()