]> git.mxchange.org Git - friendica.git/commitdiff
Functions and Calls
authorAdam Magness <adam.magness@gmail.com>
Sun, 21 Jan 2018 17:06:27 +0000 (12:06 -0500)
committerAdam Magness <adam.magness@gmail.com>
Mon, 22 Jan 2018 23:03:26 +0000 (18:03 -0500)
finish the other functions before returning to t() and tt()

mod/admin.php
mod/install.php
mod/settings.php
src/Core/L10n.php

index 454491701099db6989b9a5c06fcfb4c22389c42e..a3df2d262d9a5993c92e201569286adafa02444a 100644 (file)
@@ -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'))) {
index b39e7c949ae42422b8aa9c066fb21a98d68aa99d..b0955fdedd6bd163ab893d9d9ff925eb9a50094e 100644 (file)
@@ -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, [
index 5193c4a0461b096e92052f2465a85c87559b7b93..50588e3c6790346a50be08adf43fdb586b262393 100644 (file)
@@ -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, [
index 4fe15b504bbfaa950c29eb115a3a2ec57cf80524..7e079ea6d7f1abb8d0fb37d2eca0eb97cd31ce5a 100644 (file)
@@ -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');