Merge pull request #9361 from annando/show-language
Display the languages in the post
This commit is contained in:
commit
0d48b103a1
6 changed files with 33 additions and 1 deletions
|
@ -917,6 +917,10 @@ function item_photo_menu($item) {
|
||||||
DI::l10n()->t('Ignore') => $ignore_link
|
DI::l10n()->t('Ignore') => $ignore_link
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (!empty($item['language'])) {
|
||||||
|
$menu[DI::l10n()->t('Languages')] = 'javascript:alert(\'' . Item::getLanguageMessage($item) . '\');';
|
||||||
|
}
|
||||||
|
|
||||||
if ($network == Protocol::DFRN) {
|
if ($network == Protocol::DFRN) {
|
||||||
$menu[DI::l10n()->t("Poke")] = $poke_link;
|
$menu[DI::l10n()->t("Poke")] = $poke_link;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ function settings_post(App $a)
|
||||||
if (isset($_FILES['importcontact-filename'])) {
|
if (isset($_FILES['importcontact-filename'])) {
|
||||||
// was there an error
|
// was there an error
|
||||||
if ($_FILES['importcontact-filename']['error'] > 0) {
|
if ($_FILES['importcontact-filename']['error'] > 0) {
|
||||||
Logger::notice('Contact CSV file upload error');
|
Logger::notice('Contact CSV file upload error', ['error' => $_FILES['importcontact-filename']['error']]);
|
||||||
notice(DI::l10n()->t('Contact CSV file upload error'));
|
notice(DI::l10n()->t('Contact CSV file upload error'));
|
||||||
} else {
|
} else {
|
||||||
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
|
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
|
||||||
|
|
|
@ -2487,6 +2487,16 @@ class Item
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getLanguageMessage(array $item)
|
||||||
|
{
|
||||||
|
$used_languages = '';
|
||||||
|
foreach (json_decode($item['language'], true) as $language => $reliability) {
|
||||||
|
$used_languages .= $language . ": " . number_format($reliability, 5) . '\n';
|
||||||
|
}
|
||||||
|
$used_languages = DI::l10n()->t('Used languages in this post:\n%s', $used_languages);
|
||||||
|
return $used_languages;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an unique guid out of a given uri
|
* Creates an unique guid out of a given uri
|
||||||
*
|
*
|
||||||
|
|
|
@ -411,6 +411,11 @@ class Post
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$languages = [];
|
||||||
|
if (!empty($item['language'])) {
|
||||||
|
$languages = [DI::l10n()->t('Languages'), Item::getLanguageMessage($item)];
|
||||||
|
}
|
||||||
|
|
||||||
$tmp_item = [
|
$tmp_item = [
|
||||||
'template' => $this->getTemplate(),
|
'template' => $this->getTemplate(),
|
||||||
'type' => implode("", array_slice(explode("/", $item['verb']), -1)),
|
'type' => implode("", array_slice(explode("/", $item['verb']), -1)),
|
||||||
|
@ -466,6 +471,7 @@ class Post
|
||||||
'ignore' => $ignore,
|
'ignore' => $ignore,
|
||||||
'tagger' => $tagger,
|
'tagger' => $tagger,
|
||||||
'filer' => $filer,
|
'filer' => $filer,
|
||||||
|
'language' => $languages,
|
||||||
'drop' => $drop,
|
'drop' => $drop,
|
||||||
'vote' => $buttons,
|
'vote' => $buttons,
|
||||||
'like_html' => $responses['like']['output'],
|
'like_html' => $responses['like']['output'],
|
||||||
|
|
|
@ -217,6 +217,12 @@
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $item.language}}
|
||||||
|
<li role="menuitem">
|
||||||
|
<a id="language-{{$item.id}}" href="javascript:alert('{{$item.language.1}}');" class="btn-link filer-item language-icon" title="{{$item.language.0}}"><i class="fa fa-language" aria-hidden="true"></i> {{$item.language.0}}</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread) && ($item.ignore || $item.drop.dropping)}}
|
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread) && ($item.ignore || $item.drop.dropping)}}
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -363,6 +363,12 @@ as the value of $top_child_total (this is done at the end of this file)
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $item.language}}
|
||||||
|
<li role="menuitem">
|
||||||
|
<a id="language-{{$item.id}}" href="javascript:alert('{{$item.language.1}}');" class="btn-link filer-item language-icon" title="{{$item.language.0}}"><i class="fa fa-language" aria-hidden="true"></i> {{$item.language.0}}</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread) && ($item.ignore || $item.drop.dropping)}}
|
{{if ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.subthread) && ($item.ignore || $item.drop.dropping)}}
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
Loading…
Reference in a new issue