attachments: support i18n for attachment size #21

This commit is contained in:
Sören Weber 2021-07-17 12:37:24 +02:00
parent 919c826f8c
commit 4d5d7f6815
No known key found for this signature in database
GPG Key ID: 07D17FF580AE7589
15 changed files with 130 additions and 49 deletions

View File

@ -0,0 +1 @@
This is a small text

View File

@ -25,8 +25,14 @@ other = "المزيد"
[Expand-title] [Expand-title]
other = "...قم بتوسيع" other = "...قم بتوسيع"
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "Mehr"
[Expand-title] [Expand-title]
other = "Erweitere mich..." other = "Erweitere mich..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Anmerkung" other = "Anmerkung"

View File

@ -25,8 +25,14 @@ other = "More"
[Expand-title] [Expand-title]
other = "Expand me..." other = "Expand me..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "Más"
[Expand-title] [Expand-title]
other = "Expandir..." other = "Expandir..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Nota" other = "Nota"

View File

@ -25,9 +25,15 @@ other = "Aller plus loin"
[Expand-title] [Expand-title]
other = "Déroulez-moi..." other = "Déroulez-moi..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "o"
[Kilobyte-symbol]
other = "ko" other = "ko"
[Megabyte-symbol]
other = "Mo"
[note] [note]
other = "Remarque" other = "Remarque"

View File

@ -25,8 +25,14 @@ other = "अधिक सामग्री दिखाएं"
[Expand-title] [Expand-title]
other = "विस्तार करे..." other = "विस्तार करे..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "Lainnya"
[Expand-title] [Expand-title]
other = "Bentangkan..." other = "Bentangkan..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "更に"
[Expand-title] [Expand-title]
other = "開く..." other = "開く..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "Snelkoppelingen"
[Expand-title] [Expand-title]
other = "Lees meer..." other = "Lees meer..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "Mais"
[Expand-title] [Expand-title]
other = "Expandir..." other = "Expandir..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Nota" other = "Nota"

View File

@ -25,8 +25,14 @@ other = "Еще"
[Expand-title] [Expand-title]
other = "Развернуть..." other = "Развернуть..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "килобайт" other = "Б"
[Kilobyte-symbol]
other = "КБ"
[Megabyte-symbol]
other = "МБ"
[note] [note]
other = "Заметка" other = "Заметка"

View File

@ -25,8 +25,14 @@ other = "Dahası Var"
[Expand-title] [Expand-title]
other = "Genişlet..." other = "Genişlet..."
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "Note" other = "Note"

View File

@ -25,8 +25,14 @@ other = "更多"
[Expand-title] [Expand-title]
other = "展开" other = "展开"
[BinaryPrefix-kilobyte] [Byte-symbol]
other = "kb" other = "B"
[Kilobyte-symbol]
other = "KB"
[Megabyte-symbol]
other = "MB"
[note] [note]
other = "注释" other = "注释"

View File

@ -3,32 +3,34 @@
{{ $title := .Get "title" | default ("Attachments-label" | T) }} {{ $title := .Get "title" | default ("Attachments-label" | T) }}
<section class="attachments {{ $style }}"> <section class="attachments {{ $style }}">
<div class="label">{{ $title }}</div> <div class="label">{{ $title }}</div>
{{if eq .Page.File.BaseFileName "index"}}
{{$.Scratch.Add "filesName" "files"}}
{{else}}
{{$.Scratch.Add "filesName" (printf "%s.files" .Page.File.BaseFileName)}}
{{end}}
<div class="attachments-files"> <div class="attachments-files">
{{ range (readDir (printf "./content/%s%s" .Page.File.Dir ($.Scratch.Get "filesName")) ) }} {{- $filesName := "files" }}
{{ $fileDir := replace $.Page.File.Dir "\\" "/" }} {{- if ne .Page.File.BaseFileName "index" }}
{{if ($.Get "pattern")}} {{- $filesName = printf "%s.files" .Page.File.BaseFileName }}
{{if (findRE ($.Get "pattern") .Name)}} {{- end}}
{{- $fileDir := replace .Page.File.Dir "\\" "/" }}
{{- $pattern := .Get "pattern" | default "" }}
{{- range (readDir (printf "content/%s%s" .Page.File.Dir $filesName) ) }}
{{- if findRE $pattern .Name}}
{{- $size := .Size }}
{{- $unit := "Byte-symbol" }}
{{- if ge $size 1024 }}
{{- $size = div $size 1024 }}
{{- $unit = "Kilobyte-symbol" }}
{{- end }}
{{- if ge $size 1024 }}
{{- $size = div $size 1024 }}
{{- $unit = "Megabyte-symbol" }}
{{- end }}
{{- $unitsymbol := $unit | T }}
<li> <li>
<a href="{{ (printf "%s%s/%s" $fileDir ($.Scratch.Get "filesName") .Name) | relURL }}" > <a href="{{ (printf "%s%s/%s" $fileDir $filesName .Name) | relLangURL }}">{{.Name}}</a>
{{.Name}} ({{$size}} {{$unitsymbol}})
</a>
({{div .Size 1024 }} {{T "BinaryPrefix-kilobyte"}})
</li> </li>
{{end}} {{- end }}
{{else}} {{- end }}
<li>
<a href="{{ (printf "%s%s/%s" $fileDir ($.Scratch.Get "filesName") .Name) | relURL }}" >
{{.Name}}
</a>
({{div .Size 1024 }} {{T "BinaryPrefix-kilobyte"}})
</li>
{{end}}
{{end}}
</div> </div>
{{.Inner}} {{- .Inner }}
</section> </section>