*/
namespace Friendica\Core;
-use Friendica\Core\Config;
-use dba;
+use Friendica\BaseObject;
+use Friendica\Database\DBA;
+use Friendica\Core\System;
require_once 'boot.php';
require_once 'include/dba.php';
* Provide Languange, Translation, and Localisation functions to the application
* Localisation can be referred to by the numeronym L10N (as in: "L", followed by ten more letters, and then "N").
*/
-class L10n extends \Friendica\BaseObject
+class L10n extends BaseObject
{
/**
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
$a->strings = [];
// load enabled addons strings
- $addons = dba::select('addon', ['name'], ['installed' => true]);
- while ($p = dba::fetch($addons)) {
+ $addons = DBA::select('addon', ['name'], ['installed' => true]);
+ while ($p = DBA::fetch($addons)) {
$name = $p['name'];
if (file_exists("addon/$name/lang/$lang/strings.php")) {
include "addon/$name/lang/$lang/strings.php";
*/
public static function tt($singular, $plural, $count)
{
+ $a = self::getApp();
+
+ if (!is_numeric($count)) {
+ logger('Non numeric count called by ' . System::callstack(20));
+ }
+
$lang = Config::get('system', 'language');
if (!empty($a->strings[$singular])) {
} else {
$i = self::stringPluralSelectDefault($count);
}
- $s = $t[$i];
+
+ // for some languages there is only a single array item
+ if (!isset($t[$i])) {
+ $s = $t[0];
+ } else {
+ $s = $t[$i];
+ }
} else {
$s = $t;
}