Tell us what you are trying to do?
I am trying to translate the text -not set- and ''Add new'' to the local language of the website which is Dutch.
Is there any documentation that you are following?
No, I could only find ways to use WPML to do this, but I only need to translate this specific word. I am not trying to create a multilingual website.
Is there a similar example that we can see?
Not really, I was able to translate all other items with the build in options of Toolset, but these items I was not able to find any way to translate them.
What is the link to your site?
You can see it live here: hidden link
The first part of the snippet works to translate the text -not set- but the second part doesn't seem to work for some reason. I have pasted the code I used below:
------------------------------
<?php
/**
* To translate -not set- and add new text on forms.
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
add_filter('gettext', function($res, $text, $domain ){
if( $res == '--- not set ---' && $domain = 'wpv-views' ){
$res = 'Maak een keuze';
}
return $res;
}, 10, 3);
-----------------------------
In the second part of the code I only changed ''Aggiungi'' to "Toevoegen". Could you let me know what is going wrong here?
Just for your information, I changed it back to the previous code. It did not only break that specific page, but the entire front-end of the website. It had the same error on all pages.
Sorry for sending it in 3 different messages, but I have seen that you changed the first part of the code that changes the translation of -not set- but this part of the code was already working properly.
It's the second part of the code to change the translation of ''Add new'' that doesn't work.