Skip to content

Commit

Permalink
chore: add i18n for searchbar placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Dec 7, 2024
1 parent d3ee0bd commit 6d7ae3f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion i18n/english.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ const ui = {
default: "Search options",
packagesCache: "Packages available in the cache",
noPackageFound: "No package found",
packageLengthErr: "Package name must be between 2 and 64 characters."
packageLengthErr: "Package name must be between 2 and 64 characters.",
registryPlaceholder: "Search packages"
},
legend: {
default: "The package is fine.",
Expand Down
3 changes: 2 additions & 1 deletion i18n/french.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ const ui = {
default: "Options de recherche",
packagesCache: "Packages disponibles dans le cache",
noPackageFound: "Aucun package trouvé",
packageLengthErr: "Le nom du package doit être compris entre 2 et 64 caractères."
packageLengthErr: "Le nom du package doit être compris entre 2 et 64 caractères.",
registryPlaceholder: "Recherche de packages"
},
legend: {
default: "Rien à signaler.",
Expand Down
4 changes: 3 additions & 1 deletion public/components/views/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ export class SearchView {
}

reset() {
const lang = currentLang();

const searchViewContainer = document.querySelector("#search--view .container");
searchViewContainer.innerHTML = "";
const form = document.createElement("form");
Expand All @@ -165,7 +167,7 @@ export class SearchView {
iconSearch.classList.add("icon-search");
const input = document.createElement("input");
input.type = "text";
input.placeholder = "fastify, express...";
input.placeholder = window.i18n[lang].search.registryPlaceholder;
input.name = "package";
input.id = "package";
formGroup.appendChild(iconSearch);
Expand Down
2 changes: 1 addition & 1 deletion views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<form>
<div class="form-group">
<i class="icon-search"></i>
<input type="text" id="package" name="package" placeholder="fastify, express..." autocomplete="off" required>
<input type="text" id="package" name="package" placeholder="[[=z.token('search.registryPlaceholder')]]" autocomplete="off" required>
</div>
</form>
<div class="cache-packages">
Expand Down

0 comments on commit 6d7ae3f

Please sign in to comment.