use Friendica\BaseObject;
use Friendica\Database\DBA;
-use Friendica\Core\Addon;
-use Friendica\Core\Logger;
-use Friendica\Core\System;
-
-require_once 'boot.php';
-require_once 'include/dba.php';
/**
* Provide Language, Translation, and Localization functions to the application
}
}
}
+
+ if (isset($_GET['lang'])) {
+ $_SESSION['language'] = $_GET['lang'];
+ }
}
public static function setLangFromSession()
/**
* @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()
{
}
}
+ 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"))) {
*
* 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)
{
* 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)
{
*
* @param string $singular
* @param string $plural
- * @param int $count
+ * @param int $count
* @return string
+ * @throws \Exception
*/
public static function tt($singular, $plural, $count)
{
/**
* 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)
{
* 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()
'rebuff' => ['rebuffed', self::t('rebuff'), self::t('rebuffed')],
];
- Addon::callHooks('poke_verbs', $arr);
+ Hook::callAll('poke_verbs', $arr);
return $arr;
}