Recently Browsing 0 members
No registered users viewing this page.
how would I do a multi-language website search with just a selector?
I have many multi-lang fields and I want to do a search through all of them at once and through all of their language values.
Is there a "selector way" of doing this? Maybe something like `title|title:de|title:it`? It seems I have seen this somewhere a long time ago but can't find in any documentation or forum search...
Or the only way of doing it is by running separate searches for each language with output formatting off and then consolidating it all in one single results array?
Because I still want to give users a result, even if it is in another language than current $user. Visitors mostly will be searching for specific terms that are very similar in all languages, but might be not used in one language version of a single page, for example. Or the user might not have switched language tohis prefered and did the search first, etc.. (many use cases in my situation)
$pages->find('title~='.$q) - maybe different operator is needed? /en/search/?q=visit = 1 results /it/search/?q=visit = 0 results Thanks for any advice!
I need help creating link in CK editor that would target my translated page, so it depends on what language user has selected.
<a href="?id=1450">view all</a> would target:
<a href="en/onion/">Onion</a> <a href="de/zwiebel"></a> depending on user defined language.
By Crowdland Technology
I'm having some issues with Greek as default language, because the page name is not created automatically when enter the title of a new page.
Any chance to add support for it?
I found this char mapping that might help on line 188
[EDIT]: A solution
This was easier than we thought, we managed to find a solution by looking at how the sanitizer of page names works.
This is how the URL looks with this solution:
For ProcessWire 3+ (what we tested) find Modules > Core > InputfieldPageName and under the “Character Replacements” Field you can add the mapping you would like.
The replacement is not in the Core yet, so adding it for reference. The mapping is adjusted and simplified, and it follows the official Transliteration found here: https://en.wikipedia.org/wiki/Romanization_of_Greek
Cheers to @PWaddict for also supplying an unofficial mapping and pointing us to the right direction
@ryan It would be great if this would be added to the Core sometime in the future and we can assist with further official mappings that are not present in this simplified version.
Elissavet from CrowdLand
In my search page, I used a selector like this :
$searchQuery = $sanitizer->entities($input->get('q')); $searchQuery = $sanitizer->selectorValue($searchQuery); $selector = 'title|subtitle|summary|html_body_noimg~=' . $searchQuery; $matches = $pages->find($selector); I don't have the same results if $searchQuery contains accent or not.
with « bâtiment » I have no result with « batiment » I have onea result : « Les bâtiments et les smart-city » Normally I should have the same results? How can I do that ?
Thanks for your help
i'm running into a funny little issue
i'm working on a multilingual website, default is English, second language French
in this website i've a form for visitors to submit an event, title, date and so on, when they submit the event, it's stored into a personnal db table
i've created a module in the admin where admins (well, of course 🙂 ) can't validate or delete the submitted events, thanks to pw, it works like breeze except for one little thing 🙂
when an admin validate an event, i use the pw api to create a page and fill all the new page fields, among which
$p = new Page(); $p->of(false); .... $p->title = $titre; $titre being the title of the event submitted and retreived from the database
the thing is that depending of the language of the admin it fills the title in English/the default language or in French if the admin language is French and what i'm looking for is to always fill the default language title whatever the admin language is, guess, to take advantage of the auto filling of other languages when the default one is filled
Funny enough i've solved the opposite problem with a multilingual select form field, using
$filters = $fieldtypes->get('FieldtypeOptions')->getOptions('filtres'); foreach($filters as $f): ... echo $f->title; // it always echo the default language option title // using this echo $liso == 'fr' ? $f->title1019 : $f->title; // i've got the right select options titles displayed in the select // of course, $liso is defined in the _init.php $langid = $user->language->id; $langiso = array(1017 => 'en', 1019 => 'fr'); $liso = $langiso[$langid]; in case anybody has an idea about this page creation 🙂
i keep searching
have a nice day