mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 10:50:24 +00:00
attachments: support i18n for attachment size #21
This commit is contained in:
parent
919c826f8c
commit
4d5d7f6815
15 changed files with 130 additions and 49 deletions
|
@ -0,0 +1 @@
|
|||
This is a small text
|
10
i18n/ar.toml
10
i18n/ar.toml
|
@ -25,8 +25,14 @@ other = "المزيد"
|
|||
[Expand-title]
|
||||
other = "...قم بتوسيع"
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
10
i18n/de.toml
10
i18n/de.toml
|
@ -25,8 +25,14 @@ other = "Mehr"
|
|||
[Expand-title]
|
||||
other = "Erweitere mich..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Anmerkung"
|
||||
|
|
10
i18n/en.toml
10
i18n/en.toml
|
@ -25,8 +25,14 @@ other = "More"
|
|||
[Expand-title]
|
||||
other = "Expand me..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
10
i18n/es.toml
10
i18n/es.toml
|
@ -25,8 +25,14 @@ other = "Más"
|
|||
[Expand-title]
|
||||
other = "Expandir..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Nota"
|
||||
|
|
|
@ -25,9 +25,15 @@ other = "Aller plus loin"
|
|||
[Expand-title]
|
||||
other = "Déroulez-moi..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
[Byte-symbol]
|
||||
other = "o"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "ko"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "Mo"
|
||||
|
||||
[note]
|
||||
other = "Remarque"
|
||||
|
||||
|
|
10
i18n/hi.toml
10
i18n/hi.toml
|
@ -25,8 +25,14 @@ other = "अधिक सामग्री दिखाएं"
|
|||
[Expand-title]
|
||||
other = "विस्तार करे..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
10
i18n/id.toml
10
i18n/id.toml
|
@ -25,8 +25,14 @@ other = "Lainnya"
|
|||
[Expand-title]
|
||||
other = "Bentangkan..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
10
i18n/ja.toml
10
i18n/ja.toml
|
@ -25,8 +25,14 @@ other = "更に"
|
|||
[Expand-title]
|
||||
other = "開く..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
10
i18n/nl.toml
10
i18n/nl.toml
|
@ -25,8 +25,14 @@ other = "Snelkoppelingen"
|
|||
[Expand-title]
|
||||
other = "Lees meer..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
10
i18n/pt.toml
10
i18n/pt.toml
|
@ -25,8 +25,14 @@ other = "Mais"
|
|||
[Expand-title]
|
||||
other = "Expandir..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Nota"
|
||||
|
|
10
i18n/ru.toml
10
i18n/ru.toml
|
@ -25,8 +25,14 @@ other = "Еще"
|
|||
[Expand-title]
|
||||
other = "Развернуть..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "килобайт"
|
||||
[Byte-symbol]
|
||||
other = "Б"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "КБ"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "МБ"
|
||||
|
||||
[note]
|
||||
other = "Заметка"
|
||||
|
|
10
i18n/tr.toml
10
i18n/tr.toml
|
@ -25,8 +25,14 @@ other = "Dahası Var"
|
|||
[Expand-title]
|
||||
other = "Genişlet..."
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "Note"
|
||||
|
|
|
@ -25,8 +25,14 @@ other = "更多"
|
|||
[Expand-title]
|
||||
other = "展开"
|
||||
|
||||
[BinaryPrefix-kilobyte]
|
||||
other = "kb"
|
||||
[Byte-symbol]
|
||||
other = "B"
|
||||
|
||||
[Kilobyte-symbol]
|
||||
other = "KB"
|
||||
|
||||
[Megabyte-symbol]
|
||||
other = "MB"
|
||||
|
||||
[note]
|
||||
other = "注释"
|
||||
|
|
|
@ -3,32 +3,34 @@
|
|||
{{ $title := .Get "title" | default ("Attachments-label" | T) }}
|
||||
<section class="attachments {{ $style }}">
|
||||
<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">
|
||||
{{ range (readDir (printf "./content/%s%s" .Page.File.Dir ($.Scratch.Get "filesName")) ) }}
|
||||
{{ $fileDir := replace $.Page.File.Dir "\\" "/" }}
|
||||
{{if ($.Get "pattern")}}
|
||||
{{if (findRE ($.Get "pattern") .Name)}}
|
||||
{{- $filesName := "files" }}
|
||||
{{- if ne .Page.File.BaseFileName "index" }}
|
||||
{{- $filesName = printf "%s.files" .Page.File.BaseFileName }}
|
||||
{{- 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>
|
||||
<a href="{{ (printf "%s%s/%s" $fileDir ($.Scratch.Get "filesName") .Name) | relURL }}" >
|
||||
{{.Name}}
|
||||
</a>
|
||||
({{div .Size 1024 }} {{T "BinaryPrefix-kilobyte"}})
|
||||
<a href="{{ (printf "%s%s/%s" $fileDir $filesName .Name) | relLangURL }}">{{.Name}}</a>
|
||||
({{$size}} {{$unitsymbol}})
|
||||
</li>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<li>
|
||||
<a href="{{ (printf "%s%s/%s" $fileDir ($.Scratch.Get "filesName") .Name) | relURL }}" >
|
||||
{{.Name}}
|
||||
</a>
|
||||
({{div .Size 1024 }} {{T "BinaryPrefix-kilobyte"}})
|
||||
</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{.Inner}}
|
||||
{{- .Inner }}
|
||||
</section>
|
||||
|
|
Loading…
Reference in a new issue