A chosen suggestion becomes a removable label in the field; the search starts with Enter or the button, so several terms and free text combine. The request sends the whole phrase (titles, model) and the term IDs. Terms are ANDed in the same filter as the countries of Q6; every record of the chosen terms is exact, ordered by the other words then by the model, then close results from the whole catalogue. The message names what makes a result exact (terms, countries as typed). Wider field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.0 KiB
JavaScript
54 lines
2.0 KiB
JavaScript
// Texts of the search field and of the results page (F4, F7), in French and
|
||
// English. Kept in the repository: the Vue translation files
|
||
// (sites/default/files/lang/*.json) are generated outside of it. The result
|
||
// messages come from the server (materio_sapi SearchMessage).
|
||
|
||
const TEXTS = {
|
||
fr: {
|
||
placeholder: 'Décrivez le matériau recherché',
|
||
loading: 'Chargement…',
|
||
end: 'Fin des résultats',
|
||
helpLabel: 'Aide à la recherche',
|
||
help: 'Décrivez en quelques mots le matériau, son usage ou l’effet recherché.',
|
||
examplesIntro: 'Par exemple :',
|
||
// Checked on 23/11: the first results answer the phrase.
|
||
examples: [
|
||
'isolant à base de champignon',
|
||
'textile qui change de couleur',
|
||
'verre qui devient opaque',
|
||
'alternative au plastique pour emballage'
|
||
],
|
||
suggestionsLabel: 'Suggestions',
|
||
suggestionsOne: '1 suggestion, flèches haut et bas pour choisir',
|
||
suggestionsMany: n => `${n} suggestions, flèches haut et bas pour choisir`,
|
||
// Terms chosen in the suggestions (Q7).
|
||
termsLabel: 'Termes choisis',
|
||
removeTerm: label => `Retirer ${label}`
|
||
},
|
||
en: {
|
||
placeholder: 'Describe the material you are looking for',
|
||
loading: 'Loading…',
|
||
end: 'End of results',
|
||
helpLabel: 'Search help',
|
||
help: 'Describe in a few words the material, its use or the effect you are looking for.',
|
||
examplesIntro: 'For example:',
|
||
examples: [
|
||
'mushroom-based insulation',
|
||
'colour-changing textile',
|
||
'glass that turns opaque',
|
||
'plastic alternative for packaging'
|
||
],
|
||
suggestionsLabel: 'Suggestions',
|
||
suggestionsOne: '1 suggestion, use up and down arrows to choose',
|
||
suggestionsMany: n => `${n} suggestions, use up and down arrows to choose`,
|
||
termsLabel: 'Chosen terms',
|
||
removeTerm: label => `Remove ${label}`
|
||
}
|
||
}
|
||
|
||
// Texts of the page language, English by default.
|
||
export function searchTexts () {
|
||
const lang = (window.drupalDecoupled && window.drupalDecoupled.lang_code) || 'en'
|
||
return TEXTS[lang] || TEXTS.en
|
||
}
|