* @property-read array $languages Channel languages
* @property-read int $circle Circle or timeline this channel is based on
* @property-read bool $publish Publish the channel
- * @property-read bool $valid Signalizes that the search condiions are valid
+ * @property-read bool $valid Indicates that the search conditions are valid
*/
class Timeline extends \Friendica\BaseEntity
{
'zh-cn' => '简体中文',
];
+ /** @var string Undetermined language */
+ const UNDETERMINED_LANGUAGE = 'un';
+
/**
* A string indicating the current language used for translation:
* - Two-letter ISO 639-1 code.
// In ISO 639-2 undetermined languages have got the code "und".
// There is no official code for ISO 639-1, but "un" is not assigned to any language.
- $languages = ['un' => $this->t('Undetermined')];
+ $languages = [self::UNDETERMINED_LANGUAGE => $this->t('Undetermined')];
foreach ($this->getDetectableLanguages() as $code) {
$code = $this->toISO6391($code);
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Hook;
+use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
*/
public static function getLanguageArray(string $body, int $count, int $uri_id = 0, int $author_id = 0, array $default = []): array
{
- $default = $default ?: ['un' => 1];
+ $default = $default ?: [L10n::UNDETERMINED_LANGUAGE => 1];
$searchtext = BBCode::toSearchText($body, $uri_id);
foreach (json_decode($item['language'], true) as $language => $reliability) {
$code = DI::l10n()->toISO6391($language);
- if ($code == 'un') {
+ if ($code == L10n::UNDETERMINED_LANGUAGE) {
$native = $language = DI::l10n()->t('Undetermined');
} else {
$native = $iso639->nativeByCode1($code);
}
if (!DI::config()->get('system', 'relay_deny_undetected_language')) {
- $languages['un'] = 'un';
+ $languages[L10n::UNDETERMINED_LANGUAGE] = L10n::UNDETERMINED_LANGUAGE;
}
ksort($languages);
use Friendica\Content\Smilies;
use Friendica\Content\Text\BBCode;
-use Friendica\Core\Cache\Enum\Duration;
+use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
}
if (empty($detected) && empty($languages)) {
- $detected = ['un'];
+ $detected = [L10n::UNDETERMINED_LANGUAGE];
}
if (empty($body) || Smilies::isEmojiPost($body)) {