Functions and Calls
finish the other functions before returning to t() and tt()
This commit is contained in:
parent
c8ecc31405
commit
45f8000ba5
|
@ -10,6 +10,7 @@ use Friendica\Content\Feature;
|
||||||
use Friendica\Content\Text\Markdown;
|
use Friendica\Content\Text\Markdown;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
|
@ -1129,7 +1130,7 @@ function admin_page_site_post(App $a)
|
||||||
function admin_page_site(App $a)
|
function admin_page_site(App $a)
|
||||||
{
|
{
|
||||||
/* Installed langs */
|
/* Installed langs */
|
||||||
$lang_choices = get_available_languages();
|
$lang_choices = L10n::getAvailableLanguages();
|
||||||
|
|
||||||
if (strlen(Config::get('system', 'directory_submit_url')) &&
|
if (strlen(Config::get('system', 'directory_submit_url')) &&
|
||||||
!strlen(Config::get('system', 'directory'))) {
|
!strlen(Config::get('system', 'directory'))) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* @file mod/install.php
|
* @file mod/install.php
|
||||||
*/
|
*/
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
|
@ -259,7 +260,7 @@ function install_content(App $a) {
|
||||||
$adminmail = notags(trim($_POST['adminmail']));
|
$adminmail = notags(trim($_POST['adminmail']));
|
||||||
$timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
|
$timezone = ((x($_POST, 'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
|
||||||
/* Installed langs */
|
/* Installed langs */
|
||||||
$lang_choices = get_available_languages();
|
$lang_choices = L10n::getAvailableLanguages();
|
||||||
|
|
||||||
$tpl = get_markup_template('install_settings.tpl');
|
$tpl = get_markup_template('install_settings.tpl');
|
||||||
$o .= replace_macros($tpl, [
|
$o .= replace_macros($tpl, [
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Content\Feature;
|
||||||
use Friendica\Content\Nav;
|
use Friendica\Content\Nav;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
|
@ -1186,7 +1187,7 @@ function settings_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Installed langs */
|
/* Installed langs */
|
||||||
$lang_choices = get_available_languages();
|
$lang_choices = L10n::getAvailableLanguages();
|
||||||
|
|
||||||
/// @TODO Fix indending (or so)
|
/// @TODO Fix indending (or so)
|
||||||
$o .= replace_macros($stpl, [
|
$o .= replace_macros($stpl, [
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Core;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
||||||
|
require_once 'boot.php';
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,14 +184,14 @@ class L10n
|
||||||
if (is_array($t)) {
|
if (is_array($t)) {
|
||||||
$plural_function = 'string_plural_select_' . str_replace('-', '_', $lang);
|
$plural_function = 'string_plural_select_' . str_replace('-', '_', $lang);
|
||||||
if (function_exists($plural_function)) {
|
if (function_exists($plural_function)) {
|
||||||
$plural_function = 'string_plural_select_default';
|
$plural_function = 'self::stringPluralSelectDefault';
|
||||||
}
|
}
|
||||||
$i = $plural_function($count);
|
$i = $plural_function($count);
|
||||||
$s = $t[$i];
|
$s = $t[$i];
|
||||||
} else {
|
} else {
|
||||||
$s = $t;
|
$s = $t;
|
||||||
}
|
}
|
||||||
} elseif (string_plural_select_default($count)) {
|
} elseif (self::stringPluralSelectDefault($count)) {
|
||||||
$s = $plural;
|
$s = $plural;
|
||||||
} else {
|
} else {
|
||||||
$s = $singular;
|
$s = $singular;
|
||||||
|
@ -201,9 +202,10 @@ class L10n
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// provide a fallback which will not collide with
|
/**
|
||||||
// a function defined in any language file
|
* Provide a fallback which will not collide with a function defined in any language file
|
||||||
function string_plural_select_default($n)
|
*/
|
||||||
|
private static function stringPluralSelectDefault($n)
|
||||||
{
|
{
|
||||||
return $n != 1;
|
return $n != 1;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +223,8 @@ class L10n
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function get_available_languages() {
|
public static function getAvailableLanguages()
|
||||||
|
{
|
||||||
$langs = [];
|
$langs = [];
|
||||||
$strings_file_paths = glob('view/lang/*/strings.php');
|
$strings_file_paths = glob('view/lang/*/strings.php');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue