From: Adam Magness Date: Sun, 21 Jan 2018 17:06:27 +0000 (-0500) Subject: Functions and Calls X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=45f8000ba5990be37f70fe2e5226b0971793bb77;p=friendica.git Functions and Calls finish the other functions before returning to t() and tt() --- diff --git a/mod/admin.php b/mod/admin.php index 4544917010..a3df2d262d 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -10,6 +10,7 @@ use Friendica\Content\Feature; use Friendica\Content\Text\Markdown; use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; @@ -1129,7 +1130,7 @@ function admin_page_site_post(App $a) function admin_page_site(App $a) { /* Installed langs */ - $lang_choices = get_available_languages(); + $lang_choices = L10n::getAvailableLanguages(); if (strlen(Config::get('system', 'directory_submit_url')) && !strlen(Config::get('system', 'directory'))) { diff --git a/mod/install.php b/mod/install.php index b39e7c949a..b0955fdedd 100644 --- a/mod/install.php +++ b/mod/install.php @@ -3,6 +3,7 @@ * @file mod/install.php */ use Friendica\App; +use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBM; use Friendica\Database\DBStructure; @@ -259,7 +260,7 @@ function install_content(App $a) { $adminmail = notags(trim($_POST['adminmail'])); $timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles'); /* Installed langs */ - $lang_choices = get_available_languages(); + $lang_choices = L10n::getAvailableLanguages(); $tpl = get_markup_template('install_settings.tpl'); $o .= replace_macros($tpl, [ diff --git a/mod/settings.php b/mod/settings.php index 5193c4a046..50588e3c67 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -8,6 +8,7 @@ use Friendica\Content\Feature; use Friendica\Content\Nav; use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; @@ -1186,7 +1187,7 @@ function settings_content(App $a) } /* Installed langs */ - $lang_choices = get_available_languages(); + $lang_choices = L10n::getAvailableLanguages(); /// @TODO Fix indending (or so) $o .= replace_macros($stpl, [ diff --git a/src/Core/L10n.php b/src/Core/L10n.php index 4fe15b504b..7e079ea6d7 100644 --- a/src/Core/L10n.php +++ b/src/Core/L10n.php @@ -7,6 +7,7 @@ namespace Friendica\Core; use Friendica\Core\Config; use dba; +require_once 'boot.php'; require_once 'include/dba.php'; /** @@ -183,14 +184,14 @@ class L10n if (is_array($t)) { $plural_function = 'string_plural_select_' . str_replace('-', '_', $lang); if (function_exists($plural_function)) { - $plural_function = 'string_plural_select_default'; + $plural_function = 'self::stringPluralSelectDefault'; } $i = $plural_function($count); $s = $t[$i]; } else { $s = $t; } - } elseif (string_plural_select_default($count)) { + } elseif (self::stringPluralSelectDefault($count)) { $s = $plural; } else { $s = $singular; @@ -201,9 +202,10 @@ class L10n return $s; } - // provide a fallback which will not collide with - // a function defined in any language file - function string_plural_select_default($n) + /** + * Provide a fallback which will not collide with a function defined in any language file + */ + private static function stringPluralSelectDefault($n) { return $n != 1; } @@ -221,7 +223,8 @@ class L10n * * @return array */ - function get_available_languages() { + public static function getAvailableLanguages() + { $langs = []; $strings_file_paths = glob('view/lang/*/strings.php');