diff options
author | Jimmy Cai <jimmehcai@gmail.com> | 2020-11-06 13:49:30 +0300 |
---|---|---|
committer | Jimmy Cai <jimmehcai@gmail.com> | 2020-11-06 13:49:30 +0300 |
commit | c018f4967ab5896b1592fcf971287b8e01f61fdb (patch) | |
tree | a00e43b5e39cc732c538d985df8cf1a1b39ff131 /layouts | |
parent | f5d45458fd55a4fdbff846f132d039518b07d3a3 (diff) |
feat(search): i18n support
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/page/search.html | 8 | ||||
-rw-r--r-- | layouts/partials/widget/search.html | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/layouts/page/search.html b/layouts/page/search.html index c6f0c0c..921fa94 100644 --- a/layouts/page/search.html +++ b/layouts/page/search.html @@ -7,8 +7,8 @@ {{ define "main" }} <form action="{{ .Permalink }}" class="search-form"{{ with .OutputFormats.Get "json" -}} data-json="{{ .Permalink }}"{{- end }}> <p> - <label>Keyword</label> - <input name="keyword" placeholder="Type something..." /> + <label>{{ T "searchTitle" }}</label> + <input name="keyword" placeholder="{{ T `searchPlaceholder` }}" /> </p> <button title="Search"> @@ -19,6 +19,10 @@ <h3 class="search-result--title"></h3> <div class="search-result--list article-list--compact"></div> +<script> + window.searchResultTitleTemplate = "{{ T `searchResultTitle` }}" +</script> + {{- $opts := dict "minify" hugo.IsProduction "JSXFactory" "createElement" -}} {{- $searchScript := resources.Get "ts/search.tsx" | js.Build $opts -}} <script type="text/javascript" src="{{ $searchScript.RelPermalink }}" defer></script> diff --git a/layouts/partials/widget/search.html b/layouts/partials/widget/search.html index 6f0a2e4..fc6d525 100644 --- a/layouts/partials/widget/search.html +++ b/layouts/partials/widget/search.html @@ -1,7 +1,7 @@ <form action="/search" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}> <p> - <label>Search</label> - <input name="keyword" required placeholder="Type something..." /> + <label>{{ T "searchTitle" }}</label> + <input name="keyword" required placeholder="{{ T `searchPlaceholder` }}" /> <button title="Search"> {{ partial "helper/icon" "search" }} |