mirror of
https://github.com/friendica/friendica
synced 2025-04-28 11:04:22 +02:00
Improved handling for undeterminded languages
This commit is contained in:
parent
6cd0e1e35f
commit
6e830f7774
4 changed files with 79 additions and 72 deletions
|
@ -2107,7 +2107,7 @@ class Item
|
|||
}
|
||||
|
||||
if (empty($searchtext)) {
|
||||
return [];
|
||||
return ['un' => 1];
|
||||
}
|
||||
|
||||
$ld = new Language(DI::l10n()->getDetectableLanguages());
|
||||
|
@ -2130,6 +2130,10 @@ class Item
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($result)) {
|
||||
return ['un' => 1];
|
||||
}
|
||||
|
||||
$result = self::compactLanguages($result);
|
||||
|
||||
arsort($result);
|
||||
|
@ -2240,8 +2244,13 @@ class Item
|
|||
foreach (json_decode($item['language'], true) as $language => $reliability) {
|
||||
$code = DI::l10n()->toISO6391($language);
|
||||
|
||||
$native = $iso639->nativeByCode1($code);
|
||||
$language = $iso639->languageByCode1($code);
|
||||
if ($code == 'un') {
|
||||
$native = $language = DI::l10n()->t('Undetermined');
|
||||
} else {
|
||||
$native = $iso639->nativeByCode1($code);
|
||||
$language = $iso639->languageByCode1($code);
|
||||
}
|
||||
|
||||
if ($native != $language) {
|
||||
$used_languages .= DI::l10n()->t('%s (%s - %s): %s', $native, $language, $code, number_format($reliability, 5)) . '\n';
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue