Forums › Forums › Search & Filter Pro › using string to translate text in within filter
- This topic has 25 replies, 3 voices, and was last updated 5 years, 6 months ago by Trevor.
-
Anonymous(Private) June 17, 2019 at 12:39 pm #214151
Hello I have your filter setup but our client is after the filter to be available in different languages. I have created a single-downloads template and a single-downloads_french template and made the appropriate changes, however I am looking for a string to replace the text within the dropdowns and text next to the selector boxes.
Is this possible and you have any guidelines to follow to implement this?
Thanks Phil
Anonymous(Private) June 17, 2019 at 4:12 pm #214211Hello, No I am not using any translation plugin. I am wanting to translate manually as so the translation is as accurate as possible. I was hoping to add a custom string to either the post type or the function.php so it will replace a specific word within the filter to the translated version.
Thanks
Trevor(Private) June 17, 2019 at 4:24 pm #214215Frontend or backend? If it is frontend, that will get complicated. Backend, I am not sure it is possible. Front option terms can be manually changed using a filter (https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object). But some other form elements cannot (like the headings) – you may need to use JavaScript to do this, and might not be ideal..
Anonymous(Private) June 17, 2019 at 4:37 pm #214227Hello Sorry I was talking about frontend, as reference you can take a look at this link. I only need to translate the filter options now.
https://extensions.brookstonesites.co.uk/downloads_frenchAnonymous(Private) June 19, 2019 at 9:56 am #214427I am trying this code from the documentation you supplied. However it just removes all the options.
How can I use this correctly?<?php function filter_input_object($input_object, $sfid) { foreach($input_object['options'] as $option) { if($option->value=="brochures") {//the option with no value is always the "all items" or unselected state $option->label = "Brochures"; } else if($option->value=="brochures") {//we want to change the label for the option "black" - we can feed back in the count number to the label for this field type $option->label = "test (".$option->count.")"; } } } add_filter('sf_input_object_pre', 'filter_input_object', 10, 2); ?>
Trevor(Private) June 19, 2019 at 11:20 am #214449I think you need to take a look at some of the snippets shown in this search:
https://support.searchandfilter.com/forums/search/sf_input_object_pre+label+option/
-
AuthorPosts