forked from tk-sls.de/linuxfoo-gitlab
include .mo file
This commit is contained in:
parent
1c00192836
commit
c543ac72dd
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
lang/*.mo
|
|
BIN
lang/linuxfoo-gitlab-de_DE.mo
Normal file
BIN
lang/linuxfoo-gitlab-de_DE.mo
Normal file
Binary file not shown.
@ -22,8 +22,8 @@ msgid "http://tk-sls.de/ref/gitlab-list-commits"
|
|||||||
msgstr "http://tk-sls.de/ref/gitlab-list-commits"
|
msgstr "http://tk-sls.de/ref/gitlab-list-commits"
|
||||||
|
|
||||||
#. Description of the plugin
|
#. Description of the plugin
|
||||||
msgid "Summary: Embed list of most recent commits to a Gitlab project from a Gitlab instance's public REST API. Example: Add [gitlab-list-commits url=https://tk-sls.de/gitlab project_id=42 since=\"3 month\" max=5] for a list of at most 5 commits to that project that were made since at most 3 months ago."
|
msgid "Summary: Embed list of most recent commits to a Gitlab project from a Gitlab instance's public REST API. Example: Add [gitlab-list-commits url=https://tk-sls.de/gitlab project_id=42 commits=\"all\" since=\"3 month\" max=5 releases=\"latest\"] for a list of at most 5 commits to that project that were made since at most 3 months ago, followed by alink to the latest release of the project (if any). To disable the list of commits, set commits=\"none\". To generate a list of all releases, set releases=\"all\". To disable the list of releases, omit the \"releases\" attribute or set releases=\"none\"."
|
||||||
msgstr "Zusammenfassung: Bette Liste der neuesten Commits eines Gitlab-Projektes ein, die mit Gitlabs REST API abgerufen wird. Beispiel: Füge folgenden Shortcode zu einem Artikel hinzu, um die letzten 5 Commits anzuzeigen, die nicht älter als 3 Monate sind: [gitlab-list-commits url=https://tk-sls.de/gitlab project_id=42 since=\"3 month\" max=5]"
|
msgstr "Zusammenfassung: Bette Liste der neuesten Commits eines Gitlab-Projektes ein, die mit Gitlabs REST API abgerufen wird. Beispiel: Füge folgenden Shortcode zu einem Artikel hinzu, um die letzten 5 Commits anzuzeigen, die nicht älter als 3 Monate sind: [gitlab-list-commits url=https://tk-sls.de/gitlab project_id=42 since=\"3 month\" max=5]. Um die Liste der Commits zu deaktivieren: commits=\"none\". Um eine Liste von Releases hinzuzufügen: releases=\"all\". Um nur die neueste Release anzuzeigen: releases=\"latest\"."
|
||||||
|
|
||||||
#. Author of the plugin
|
#. Author of the plugin
|
||||||
msgid "Tilman Kranz"
|
msgid "Tilman Kranz"
|
||||||
|
@ -47,6 +47,43 @@ class LinuxfooGitlab {
|
|||||||
return sprintf(__('since %d %s ago', 'linuxfoo-gitlab'), $num, $unit);
|
return sprintf(__('since %d %s ago', 'linuxfoo-gitlab'), $num, $unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function format_commit($atts, $commit) {
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
preg_match('/^....-..-../', $commit->committed_date, $m);
|
||||||
|
$date = $m[0];
|
||||||
|
|
||||||
|
$title = htmlspecialchars($commit->title, ENT_NOQUOTES|ENT_HTML5|ENT_SUBSTITUTE, 'UTF-8', FALSE);
|
||||||
|
|
||||||
|
$out .=
|
||||||
|
$date.' '.
|
||||||
|
__('by', 'linuxfoo-gitlab').' '.$commit->author_name.
|
||||||
|
': '.
|
||||||
|
'<a href="'.$commit->web_url.'">'.$commit->short_id.'</a> '.$title;
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function format_commit_stats($atts, $commits_count, $branch) {
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
if($commits_count==0) {
|
||||||
|
$out .=
|
||||||
|
__('No commits', 'linuxfoo-gitlab').
|
||||||
|
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
||||||
|
(is_null($atts['since']) ? '' : ' '.('since '.$atts['since'].' ago')).'.';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$out .=
|
||||||
|
/* translators: %d: maximum number of commits displayed */
|
||||||
|
sprintf(__('Last %d commits', 'linuxfoo-gitlab'), $commits_count).
|
||||||
|
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
||||||
|
(is_null($atts['since']) ? '' : ' '.self::format_since($atts['since'])).':';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
static function commits_list($atts, $project_url) {
|
static function commits_list($atts, $project_url) {
|
||||||
$since = null;
|
$since = null;
|
||||||
|
|
||||||
@ -99,37 +136,18 @@ class LinuxfooGitlab {
|
|||||||
else {
|
else {
|
||||||
$commits_count = count($commits);
|
$commits_count = count($commits);
|
||||||
$commits_count = is_null($atts['max']) ? $commits_count : min($commits_count, $atts['max']);
|
$commits_count = is_null($atts['max']) ? $commits_count : min($commits_count, $atts['max']);
|
||||||
|
|
||||||
$commits = array_slice($commits, 0, $commits_count);
|
$commits = array_slice($commits, 0, $commits_count);
|
||||||
|
|
||||||
if($commits_count==0) {
|
$out .=
|
||||||
$out .=
|
'<span class="stats">'.
|
||||||
'<span class="stats">'.
|
self::format_commit_stats($atts, $commits_count, $branch).
|
||||||
__('No commits', 'linuxfoo-gitlab').
|
'</span>';
|
||||||
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
|
||||||
(is_null($atts['since']) ? '' : ' '.('since '.$atts['since'].' ago')).'.'.
|
if($commits_count>0) {
|
||||||
'</span>';
|
$out .= '<ul class="commits">';
|
||||||
}
|
|
||||||
else {
|
|
||||||
$out .=
|
|
||||||
'<span class="stats">'.
|
|
||||||
/* translators: %d: maximum number of commits displayed */
|
|
||||||
sprintf(__('Last %d commits', 'linuxfoo-gitlab'), $commits_count).
|
|
||||||
(is_null($branch) ? '' : ' '.__('in branch', 'linuxfoo-gitlab').' "'.$branch.'"').
|
|
||||||
(is_null($atts['since']) ? '' : ' '.self::format_since($atts['since'])).':'.
|
|
||||||
'</span>'.
|
|
||||||
'<ul class="commits">';
|
|
||||||
|
|
||||||
foreach($commits as $commit) {
|
foreach($commits as $commit) {
|
||||||
preg_match('/^....-..-../', $commit->committed_date, $m);
|
$out .= '<li>'.self::format_commit($atts, $commit).'</li>';
|
||||||
$date = $m[0];
|
|
||||||
|
|
||||||
$title = htmlspecialchars($commit->title, ENT_NOQUOTES|ENT_HTML5|ENT_SUBSTITUTE, 'UTF-8', FALSE);
|
|
||||||
|
|
||||||
$out .=
|
|
||||||
'<li>'.
|
|
||||||
$date.': <a href="'.$commit->web_url.'">'.$commit->short_id.'</a> '.$title.
|
|
||||||
'</li>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= '</ul>';
|
$out .= '</ul>';
|
||||||
|
Loading…
Reference in New Issue
Block a user