Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a multilingual site (English and Welsh).
Been playing around with the XSLT file to try to get preview fields to display content in the correct language
E.g at the moment, if I search 'Sport (an English search term)' or 'Chwaraeon (a Welsh search term), both preview results are shown in English.
English - http://www.cymoedd.ac.uk/search.aspx?search=sport
Welsh - http://www.cymoedd.ac.uk/search.aspx?search=chwaraeon
What I would want is preview results to show English if an English search term is used, and Welsh if Welsh is used.
My English/Welsh content is defined via an alias e.g bodyTextEN, bodyTextCY
Any help or suggesstion would be greatly appreciated.
XSLTsearch assumes you'd have different sections in your content tree for each language. Something like:
- Page 1
- Page 2
- Page 3
- Welsh Page 1
- Welsh Page 2
- Welsh Page 3
- Welsh Search
Each search page (the english one and the welsh one) would search within the portion of the content tree that it is in. That's the default behavior and the expectation XSLTsearch has of the content tree structure.
Your site, if I understand correctly, has a single structure for both languages together, and different properties for each language. This is more typical of what's called a one-to-one or 1:1 pattern. (The excellent Vorto package can help with that if you're not using it.)
The 1:1 pattern isn't what XSLTsearch was designed for. So it'll take a bit of tweaking to sort it out.
The easiest option would be to create two search pages, one for English and one for Welsh.
- Page 1
- Page 2
- Page 3
(Google tells me chwilio is Welsh for search. Forgive me if I've gotten it totally wrong in these examples!)
I'm going to assume that you can use the umbracoNaviHide property to hide the Search and Chwilio pages from the site's navigation, sitemap, and search results. That way visitors don't know you have two different search pages.
Each search page (english and welsh) will have different parameters to the macro for the fields to search and preview. On the english page you'd use the bodyTextEN field, for example, and on the Welsh search page you'd use the bodyTextCY field.
There are other options, such as passing the language in as a search parameter and then modifying the xsltsearch.xslt file to notice that and update the field names to append it so you search within the correct language properties. That's much more effort, though, and would hamper any upgrades to XSLTsearch itself.
Also, look in to ezSearch, which works the same way as XSLTsearch and is preferred over the older XSLTsearch. (It uses Razor and Examine rather than XSLT so it's both faster and easier to modify if you need to).
Hope this helps as you consider how to architect the best solution.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted