2018-11-06 11:16:13 +01:00
|
|
|
{{- $allgood := true -}} <!-- "allgood" will say whether all translations are fine -->
|
2018-10-10 18:06:27 +02:00
|
|
|
{{- range .Site.Pages -}} <!-- range through all pages -->
|
2018-11-06 11:16:13 +01:00
|
|
|
{{- $uptodate := true -}} <!-- reset uptodate var -->
|
2018-10-11 12:11:11 +02:00
|
|
|
{{- $main_date := .Lastmod -}} <!-- last modification date of EN file -->
|
2018-10-10 18:06:27 +02:00
|
|
|
{{- range .Translations -}} <!-- range through all translations of .Page -->
|
|
|
|
{{- if and (.IsTranslated) (.IsPage) -}}
|
|
|
|
{{- $i18n_date := .Lastmod -}}
|
2018-10-11 12:11:11 +02:00
|
|
|
{{- if ($main_date.After $i18n_date) -}} <!-- EN .Lastmod is newer than .Lastmod of translation -->
|
2018-11-06 11:16:13 +01:00
|
|
|
{{- $uptodate = false -}} <!-- at least one translation failed -->
|
|
|
|
{{- $allgood = false -}} <!-- at least one translation failed -->
|
2018-10-10 18:06:27 +02:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2018-11-06 11:16:13 +01:00
|
|
|
{{- if eq $uptodate false }} <!-- if at least one translation failed -->
|
2018-10-10 18:06:27 +02:00
|
|
|
<h3><a href="{{ .Permalink }}">{{ .File.Path }}</a></h3>
|
|
|
|
<table class="transstatus">
|
|
|
|
<thead><tr>
|
|
|
|
<th>Lang</th>
|
|
|
|
<th>Page</th>
|
|
|
|
<th>Translation date</th>
|
|
|
|
<th>Original date</th>
|
2018-10-11 12:11:11 +02:00
|
|
|
<th>Version Diff</th>
|
2018-10-10 18:06:27 +02:00
|
|
|
</tr></thead>
|
2018-10-11 12:11:11 +02:00
|
|
|
{{ $main_date := .Lastmod -}} <!-- same logic as above, now with output -->
|
|
|
|
{{- $main_version := .Params.version -}} <!-- "version" value of file's front matter -->
|
2018-10-10 18:06:27 +02:00
|
|
|
{{ range sort .Translations ".Lang" }}
|
|
|
|
{{- if and (.IsTranslated) (.IsPage) -}}
|
|
|
|
{{- $i18n_date := .Lastmod -}}
|
2018-10-11 12:11:11 +02:00
|
|
|
{{- $i18n_version := .Params.version -}}
|
|
|
|
{{- if ($main_date.After $i18n_date) -}}
|
2018-10-10 18:06:27 +02:00
|
|
|
<tr>
|
|
|
|
<td>{{ .Lang | upper }}</td>
|
|
|
|
<td><a href="{{ .Permalink }}">{{ .File.Path }}</a></td>
|
2018-10-11 12:11:11 +02:00
|
|
|
<td>{{ $i18n_date.Format "2006-01-02" }} (v{{ $i18n_version }})</td>
|
|
|
|
<td>{{ $main_date.Format "2006-01-02" }} (v{{ $main_version }})</td>
|
|
|
|
<td>{{ sub $main_version $i18n_version }}</td>
|
2018-10-10 18:06:27 +02:00
|
|
|
</tr>
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2018-10-09 14:44:39 +02:00
|
|
|
{{ end }}
|
2018-10-10 18:06:27 +02:00
|
|
|
</table>
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2018-10-09 14:44:39 +02:00
|
|
|
|
2018-11-06 11:16:13 +01:00
|
|
|
{{- if eq $allgood true -}}
|
2018-10-09 14:44:39 +02:00
|
|
|
<p style="text-align:center;">Everything is up to date! 👍</p>
|
2018-10-10 18:06:27 +02:00
|
|
|
{{- end -}}
|