From c543ac72dd041629f15557c4a3c29d0a98333f84 Mon Sep 17 00:00:00 2001 From: Tilman Kranz Date: Sun, 28 Nov 2021 00:47:07 +0100 Subject: [PATCH] include .mo file --- .gitignore | 1 - lang/linuxfoo-gitlab-de_DE.mo | Bin 0 -> 3401 bytes lang/linuxfoo-gitlab-de_DE.po | 4 +- linuxfoo-gitlab.php | 72 +++++++++++++++++++++------------- 4 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 lang/linuxfoo-gitlab-de_DE.mo diff --git a/.gitignore b/.gitignore index a23b892..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -lang/*.mo diff --git a/lang/linuxfoo-gitlab-de_DE.mo b/lang/linuxfoo-gitlab-de_DE.mo new file mode 100644 index 0000000000000000000000000000000000000000..0f91cfe2e6d809276d23c6b7c1ab0ad3ca4d5595 GIT binary patch literal 3401 zcmbuB%WoS+9LJ~h0R+mUEpJr)u$sQe+Hp$M%3ws2rd4QCLh8^8RH3nVY)`#A>(0#P z^*5l3OAp+80U?eEL2tRhUjP!Qr%FiNxb%bs-`U-95|lQPy3+dNUH@i&&-wj)@6f*6 z4A+~*{SP>d`;R^Nz}0_(vDd+y;9KAq#q)RIb9nv*JP!T_o&x^`Pk^WPGIk977%YKH z;Pc>Dpj-DfI0XIxy8YL|r@(vQ8{nUyTeo*#{(Ky~guN$0xBsmJj6Dl}58@SD2Ty`O zgD--AgHMBdpJWVQ*+J0hKLYLtkAXMf<7x01o^L}rfj@%Ip5H-d=L2vA+>gyF;20Qy zP4G1MC3q7233PhzgHF!_@D=a?oOJsi1+f*I0*`{Tp!2T>I)870d*I(U;AuR63+J4F zzv9E$dmnUq{sNtz!v}N!hC#T%Dj=4!v!L^L5-d`f*?~ufkY<;&&&j&W?d5Xs);N96 z7N^hc=`RJMDnDAR*z0o{?j)&2B)Ab~CpjZkOY9_+>IfpU z+*le8sjwB#R^UyciCs|)Jsto{L=NTkodqyZgV%s{dUen+r{fbS^lsrw7{03$n}t4R;V+? zJIM&Pj-q545p1p!N>}yr%>?Djy)`bjwkrl2PRcfMwR);djf6sJ+(F3%d?JeAjF1t7 zOw>y%Q7A;WrX!Tl@DEAwOAr&U&gAQSf#>mhs4g!yLJ1CeW=6@sE5UE8Wiy2;97ku3 z|H+%f8eNIR7xmobhFYoCsGw*SjbI>NW(^s|T+t=X)fx-=s$nkeTe7Z2yU6^O8p#B= z)CZG_n%Jn-Wm)zO%c{Yhz2Pi1Y*lb=SaHmPnK1Z7XoKcd^R>K9KcZ@RY-mCB(Vv1j z(~)5?nRZOjNNVIObUD#sUkhW(iSATP+IPa0ew22ks-OVUm3EQ@dG!vtb`UgRra?I* zx<;ErK=0Xd&&A?{LDj!MG&eIhy#2~-2V zG`aTEBAD4cEHa@;m`tE(G}|P{E67sXvushVrP2BwG_(%J!&RXzwb$=zn%{0@>_WJx z;CyiGLf)SPwEbO3`ysLm(PEScyM{xDf-WM;E{hbyM9@M$AJ`=!6&gU#rXq@j8p!1# z42n2CBoW0XW-w%Skb6YRE+=+bs4z>zM)2FB8(H>gYIqzA)#k>et`;YSg$uJ70D?l~ zP32AvtS9G`DbA?(0Wa`+1f3Es87(UJ&MSrt#{AMvVcEP44G+bNvvFPu{KulA8p+LBcommitted_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. + ': '. + ''.$commit->short_id.' '.$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) { $since = null; @@ -99,37 +136,18 @@ class LinuxfooGitlab { else { $commits_count = count($commits); $commits_count = is_null($atts['max']) ? $commits_count : min($commits_count, $atts['max']); - $commits = array_slice($commits, 0, $commits_count); - 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'])).':'. - ''. - '
    '; + $out .= + ''. + self::format_commit_stats($atts, $commits_count, $branch). + ''; + + if($commits_count>0) { + $out .= '
      '; foreach($commits as $commit) { - preg_match('/^....-..-../', $commit->committed_date, $m); - $date = $m[0]; - - $title = htmlspecialchars($commit->title, ENT_NOQUOTES|ENT_HTML5|ENT_SUBSTITUTE, 'UTF-8', FALSE); - - $out .= - '
    • '. - $date.': '.$commit->short_id.' '.$title. - '
    • '; + $out .= '
    • '.self::format_commit($atts, $commit).'
    • '; } $out .= '
    ';