From 13d8e69b93c51776cd7fe73961f6873d756a995e Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sat, 28 Dec 2024 05:21:24 +0100 Subject: search translate --- assets/js/search.js | 8 ++------ i18n/en-shaw.yml | 19 +++++++++++++------ i18n/en.yml | 19 +++++++++++++------ layouts/_default/search.html | 13 ++++++++++--- layouts/partials/pagination.html | 4 ++-- 5 files changed, 40 insertions(+), 23 deletions(-) diff --git a/assets/js/search.js b/assets/js/search.js index 2dc147e..ab2256b 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -63,19 +63,15 @@ function renderResults(results) { resultBox.appendChild(resultEntry(value.item, key)) }) } else { - resultBox.innerHTML = - "

No matches found

" + resultBox.innerHTML = document.getElementById("no-match").innerHTML } } -addEventListener("load", function (){ +addEventListener("load", function () { let searchQuery = getUrlParameter(location.search, "q") if (searchQuery) { document.getElementById("search-query").value = searchQuery executeSearch(searchQuery).then(renderResults) - } else { - document.getElementById("search-results").innerHTML = - "

Please enter a word or phrase above

" } } ) diff --git a/i18n/en-shaw.yml b/i18n/en-shaw.yml index 278709d..c42630e 100644 --- a/i18n/en-shaw.yml +++ b/i18n/en-shaw.yml @@ -14,15 +14,22 @@ tag: talk: one: ๐‘‘๐‘ท๐‘’ other: ๐‘‘๐‘ท๐‘’๐‘• +match_found: + one: "๐‘ฅ๐‘จ๐‘— ๐‘“๐‘ฌ๐‘ฏ๐‘›" + other: "๐‘ฅ๐‘จ๐‘—๐‘ฉ๐‘Ÿ ๐‘“๐‘ฌ๐‘ฏ๐‘›" # Rest -next: ๐‘ฏ๐‘ง๐‘’๐‘•๐‘‘ -prev: ๐‘๐‘ฎ๐‘ฐ๐‘๐‘พ๐‘• -see_all: "๐‘•๐‘ฐ ๐‘ท๐‘ค" -about: ๐‘ฉ๐‘š๐‘ฌ๐‘‘ -recent_pages: ๐‘๐‘ฑ๐‘ก๐‘ฉ๐‘Ÿ ๐‘ฎ๐‘ฐ๐‘•๐‘ฉ๐‘ฏ๐‘‘๐‘ค๐‘ฆ ๐‘ง๐‘›๐‘ฆ๐‘‘๐‘ฉ๐‘› _blank: " " -translations: ๐‘‘๐‘ฎ๐‘จ๐‘ฏ๐‘•๐‘ค๐‘ฑ๐‘–๐‘ฉ๐‘ฏ๐‘Ÿ +about: ๐‘ฉ๐‘š๐‘ฌ๐‘‘ author_by: ๐‘š๐‘ฒ minute_read: "๐‘ฅ๐‘ฐ๐‘ฏ ๐‘ฎ๐‘ฐ๐‘›" +next: "๐‘ฏ๐‘ง๐‘’๐‘•๐‘‘" +no_match_found: "๐‘ฏ๐‘ด ๐‘ฅ๐‘จ๐‘— ๐‘“๐‘ฌ๐‘ฏ๐‘›" +prev: ๐‘๐‘ฎ๐‘ฐ๐‘๐‘พ๐‘• +recent_pages: ๐‘๐‘ฑ๐‘ก๐‘ฉ๐‘Ÿ ๐‘ฎ๐‘ฐ๐‘•๐‘ฉ๐‘ฏ๐‘‘๐‘ค๐‘ฆ ๐‘ง๐‘›๐‘ฆ๐‘‘๐‘ฉ๐‘› rss_follow: "๐‘“๐‘ช๐‘ค๐‘ด {{ .section }} ๐‘ณ๐‘๐‘›๐‘ฑ๐‘‘๐‘• ๐‘๐‘ฒ๐‘ฉ RSS ๐‘“๐‘ฐ๐‘›" +search: ๐‘•๐‘ป๐‘— +search_placeholder: "๐‘ฎ๐‘ฒ๐‘‘ ๐‘˜๐‘น ๐‘•๐‘ป๐‘— ๐‘‘๐‘ป๐‘ฅ๐‘Ÿ" +search_request: "๐‘๐‘ค๐‘ฐ๐‘Ÿ ๐‘ง๐‘ฏ๐‘‘๐‘ผ ๐‘ฉ ๐‘ข๐‘ป๐‘› ๐‘น ๐‘“๐‘ฎ๐‘ฑ๐‘Ÿ ๐‘ฉ๐‘š๐‘ณ๐‘" +see_all: "๐‘•๐‘ฐ ๐‘ท๐‘ค" +translations: ๐‘‘๐‘ฎ๐‘จ๐‘ฏ๐‘•๐‘ค๐‘ฑ๐‘–๐‘ฉ๐‘ฏ๐‘Ÿ diff --git a/i18n/en.yml b/i18n/en.yml index fab158b..b2ead12 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -14,15 +14,22 @@ tag: talk: one: talk other: talks +match_found: + one: "match found" + other: "matches found" # Rest -next: next -prev: prev -see_all: "see all" -about: about -recent_pages: Pages recently edited _blank: " " -translations: translations +about: about author_by: By minute_read: "min read" +next: next +no_match_found: "no match found" +prev: prev +recent_pages: Pages recently edited rss_follow: "Follow {{ .section }} updates via RSS feed" +search: search +search_placeholder: "write your search terms" +search_request: "Please enter a word or phrase above" +see_all: "see all" +translations: translations diff --git a/layouts/_default/search.html b/layouts/_default/search.html index bcbaad4..1f179bc 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -2,7 +2,7 @@

- {{ .Title }} + {{ T "search" }}

@@ -10,14 +10,21 @@ -
+
+

{{ T "search_request" }}

+
+