From 68587dc94e9d7345a3c07f75d6ad27845660f8c2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Thu, 8 Apr 2021 12:25:26 +0200 Subject: [PATCH] fix: workaround for startinblox-feature-requests#250 --- src/locales/en.json | 2 +- src/locales/es.json | 2 +- src/locales/fr.json | 2 +- src/scripts/intl.js | 11 +++++++++++ src/views/partials/menu-left.pug | 3 ++- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index cde20c6..39880e5 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -32,7 +32,7 @@ "circlesBrowse": "Browse circles", "circleCreate": "Create circle", "messages": "Messages", - "search": "Search...", + "search": "Search", "republiqueESS": { "home": "Home", "contribute": "Contribute", diff --git a/src/locales/es.json b/src/locales/es.json index a393f2b..edfed16 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -32,7 +32,7 @@ "circlesBrowse": "Examinar los círculos", "circleCreate": "Crea un círculo.", "messages": "Mensajes", - "search": "Buscar...", + "search": "Buscar", "republiqueESS": { "home": "Hogar", "contribute": "Contribuir", diff --git a/src/locales/fr.json b/src/locales/fr.json index e58d485..b440cc3 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -32,7 +32,7 @@ "circlesBrowse": "Parcourir les cercles", "circleCreate": "Créer un cercle", "messages": "Messages", - "search": "Rechercher...", + "search": "Rechercher", "republiqueESS": { "home": "Accueil", "contribute": "Contribuer", diff --git a/src/scripts/intl.js b/src/scripts/intl.js index 5c02ae4..1f3e976 100644 --- a/src/scripts/intl.js +++ b/src/scripts/intl.js @@ -78,6 +78,17 @@ class JsI18n { this.translateNodeContent(label, k); } } + // https://git.startinblox.com/framework/sib-core/issues/755 + if (attr.startsWith('placeholder-')) { + let placeholder = node.querySelector('[placeholder="' + attr.replace("placeholder-", "") + '"]'); + if (placeholder != null) { + this.translateNodeContent(placeholder.attributes['placeholder'], k); + let input = node.querySelector('[name="' + attr.replace("placeholder-", "") + '"] > input'); + if(input != null) { + this.translateNodeContent(input.attributes['placeholder'], k); + } + } + } this.translateNodeContent(node.attributes[attr], k); } } diff --git a/src/views/partials/menu-left.pug b/src/views/partials/menu-left.pug index 2d59e0a..f3ff143 100644 --- a/src/views/partials/menu-left.pug +++ b/src/views/partials/menu-left.pug @@ -5,7 +5,8 @@ solid-form-search.icon.children-icon-magnifier( search-name='circle.name, project.customer.name, project.name, contact.username, contact.name' order-asc-names='name' - label-name='Rechercher' + placeholder-name='' + data-trans='placeholder-name=menuLeft.search' widget-name="solid-form-placeholder-text" submit-button=""