materio_sapi: result messages with real plurals; without any exact match the results are called close (the neighbour search always finds some). Former help sentence of the base page kept, French corrected. Messages in SearchMessage, unit tested; French added by update 11002. materiotheme: placeholder "Describe the material you are looking for", wider search field, "?" button with a help tooltip and clickable examples, "Loading…", "End of results"; texts in vuejs/i18n/search.js. Page title "Base" restored without a search (keys is an array, test its length). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ShDspHaZGwHoRZCsPBJzsM
49 lines
1.8 KiB
JavaScript
49 lines
1.8 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`
|
||
},
|
||
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`
|
||
}
|
||
}
|
||
|
||
// 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
|
||
}
|