Last status is split for better readability

This commit is contained in:
Michael 2023-08-16 03:28:54 +00:00 committed by Hypolite Petovan
parent 3d6748eaf7
commit a3e24a55ec
3 changed files with 30 additions and 15 deletions

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-09 19:59+0000\n"
"POT-Creation-Date: 2023-08-16 03:27+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,42 +17,46 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: twitter.php:80
#: twitter.php:84
msgid "Post to Twitter"
msgstr ""
#: twitter.php:117
#: twitter.php:123
msgid "No status."
msgstr ""
#: twitter.php:129
msgid "Allow posting to Twitter"
msgstr ""
#: twitter.php:117
#: twitter.php:129
msgid ""
"If enabled all your <strong>public</strong> postings can be posted to the "
"associated Twitter account. You can choose to do so by default (here) or for "
"every posting separately in the posting options when writing the entry."
msgstr ""
#: twitter.php:118
#: twitter.php:130
msgid "Send public postings to Twitter by default"
msgstr ""
#: twitter.php:119
#: twitter.php:131
msgid "API Key"
msgstr ""
#: twitter.php:120
#: twitter.php:132
msgid "API Secret"
msgstr ""
#: twitter.php:121
#: twitter.php:133
msgid "Access Token"
msgstr ""
#: twitter.php:122
#: twitter.php:134
msgid "Access Secret"
msgstr ""
#: twitter.php:123
#: twitter.php:135
msgid ""
"Each user needs to register their own app to be able to post to Twitter. "
"Please visit https://developer.twitter.com/en/portal/projects-and-apps to "
@ -61,6 +65,14 @@ msgid ""
"in the app settings."
msgstr ""
#: twitter.php:128
#: twitter.php:136
msgid "Last Status Summary"
msgstr ""
#: twitter.php:137
msgid "Last Status Content"
msgstr ""
#: twitter.php:142
msgid "Twitter Export"
msgstr ""

View file

@ -5,4 +5,5 @@
{{include file="field_input.tpl" field=$api_secret}}
{{include file="field_input.tpl" field=$access_token}}
{{include file="field_input.tpl" field=$access_secret}}
{{include file="field_input.tpl" field=$status_title}}
{{include file="field_textarea.tpl" field=$status}}

View file

@ -117,11 +117,12 @@ function twitter_settings(array &$data)
$access_secret = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'twitter', 'access_secret');
$last_status = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'twitter', 'last_status');
if (!empty($last_status['code'])) {
$status = print_r($last_status, true);
if (!empty($last_status['code']) && !empty($last_status['reason'])) {
$status_title = sprintf('%d - %s', $last_status['code'], $last_status['reason']);
} else {
$status = DI::l10n()->t('No status.');
$status_title = DI::l10n()->t('No status.');
}
$status_content = $last_status['content'] ?? '';
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/twitter/');
$html = Renderer::replaceMacros($t, [
@ -132,7 +133,8 @@ function twitter_settings(array &$data)
'$access_token' => ['twitter-access-token', DI::l10n()->t('Access Token'), $access_token],
'$access_secret' => ['twitter-access-secret', DI::l10n()->t('Access Secret'), $access_secret],
'$help' => DI::l10n()->t('Each user needs to register their own app to be able to post to Twitter. Please visit https://developer.twitter.com/en/portal/projects-and-apps to register a project. Inside the project you then have to register an app. You will find the needed data for the connector on the page "Keys and token" in the app settings.'),
'$status' => ['twitter-status', DI::l10n()->t('Last Status'), $status, '', '', 'readonly'],
'$status_title' => ['twitter-status-title', DI::l10n()->t('Last Status Summary'), $status_title, '', '', 'readonly'],
'$status' => ['twitter-status', DI::l10n()->t('Last Status Content'), $status_content, '', '', 'readonly'],
]);
$data = [