const DELIVER_FIELDLIST = [
'uid', 'id', 'parent', 'uri-id', 'uri', 'thr-parent', 'parent-uri', 'guid',
'parent-guid', 'conversation', 'received', 'created', 'edited', 'verb', 'object-type', 'object', 'target',
- 'private', 'title', 'body', 'raw-body', 'location', 'coord', 'app',
+ 'private', 'title', 'body', 'raw-body', 'language', 'location', 'coord', 'app',
'inform', 'deleted', 'extid', 'post-type', 'post-reason', 'gravity',
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'author-id', 'author-addr', 'author-link', 'author-name', 'author-avatar', 'owner-id', 'owner-link', 'contact-uid',
*/
private static function setOwnerforResharedItem(array $item)
{
+ if ($item['uid'] == 0) {
+ return;
+ }
+
$parent = Post::selectFirst(
['id', 'causer-id', 'owner-id', 'author-id', 'author-link', 'origin', 'post-reason'],
['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]
$used_languages = '';
foreach (json_decode($item['language'], true) as $language => $reliability) {
- $used_languages .= $iso639->nativeByCode1(substr($language, 0, 2)) . ' (' . $iso639->languageByCode1(substr($language, 0, 2)) . ' - ' . $language . "): " . number_format($reliability, 5) . '\n';
+ $code = DI::l10n()->toISO6391($language);
+
+ $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 {
+ $used_languages .= DI::l10n()->t('%s (%s): %s', $native, $code, number_format($reliability, 5)) . '\n';
+ }
}
$used_languages = DI::l10n()->t('Detected languages in this post:\n%s', $used_languages);
return $used_languages;