wp-multilang
wp-multilang copied to clipboard
Any chance a a simple cookie popup plugin can be translated with this ?
Fist of all , thank you for a superb plugin !
I am wondering how a cookie popup plugin can be translated with this, I am trying to show a cookie notification in 3 languages, on a 3 language site made with the help of this plugin. I don't understand how to make the json config file, to make a plugin's content edit box be translated. I've looked at the examples in the config folder, didn't make me smarter :) Can you please tell me how to make a simple cookie notice plugin translatable, e.g. show 3 different language messages for 3 different languages (GDPR) Thank you
If you following the guidelines at https://codex.wordpress.org/I18n_for_WordPress_Developers your plugin will be translation-ready and can be translated to any language using .PO / .MO files. This is the recommended way to go, the translation will work either with or without WP Multilang installed.
The quick-n-dirty solution would be this:
echo __('[:en]Translate me[:es]Tradúzcame[:]');
Thank you, soft79, I will try. .PO/.MO translations have no effect whatsoever here.
My problem is that the plugin is NOT developed by me, I merely have to install some form of GDPR notification bar or cookie bar, on a customer's site, that is in 3 different languages, and obviously, for each language there has to be a different message, different accept button, etc.
I will modify the simplest cookie plugin for wordpress, and try your solution, I'll get back to you with whether it has worked or not.
Unfortunately, the solution provided by soft79 is not working either. So for now, there is no simple way to do this. Just a simple example of one single line from the eucookielaw plugin, I've modified the defaults php to read in the bar messages line: array('barmessage', __('[:en]We use cookies on the site to improve your user experience[:hu]Honlapunk sütiket használ böngészési élmény javításához[:ro]Situl foloseşte cookies pentru a asigura o experienţă de utilizator îmbunătăţită[:]', 'eu-cookie-law')), This should have been then, of course, translated by wp multilang, but it doesn't get translated, and the only message displayed is still the english one. I've also tried adding json config lines, based on the plugin's WPML keys, and activated/deactivated some plugins to trigger the re-reading of those json files, but nothing happens, Here's the json file's contents: eu-cookie-law.json { "post_fields": { "peadig_eucookie": {}, "barmessage": {}, "barlink": {}, "barbutton" : {}, "boxlinkid" : {}, "closelink" : {}, "boxcontent" : {}, "bhtmlcontent" : {}, "cc-disablecookie" : {}, "cc-cookieenabled" : {}, "cc-cookiedisabled" : {}, },
} From what I understand, this should have triggered the 3 language selector headers to be added to the plugin's settings screen, but it didn't. Any further help would be greatly appreciated.
At first sight, I see an extra "," at this last line: "cc-cookiedisabled" : {},
Maybe, this is the culprit?
As you probably know, that should not and does not matter in an options enumeration. But thank you for trying. It's sooo frustrating. I've been trying for the last 5 days to find a real, straight-forward multilanguage cookie notice plugin, and there's none.
Changing the defaults doesn't make sense; in that case the translation will only be applied when the defaults are loaded which is just once.
Try this wpm-config.json file:
{
"admin_pages" : [
"settings_page_peadig_eucookie"
],
"options" : {
"peadig_eucookie" : {
"barmessage" : {},
"barlink": {},
"barbutton" : {},
"closelink" : {},
"boxcontent" : {},
"bhtmlcontent" : {}
}
}
}
Place this file in your child theme and then disable/enable any plugin so WP-Multilang will read the json.
...or even better; ask the author of the cookie-plugin to include this file into the project so it will automatically integrate with WP-Multilang.
I am using "HashBar Pro - WordPress Notification Bar" ($10) https://codecanyon.net/item/hashbar-pro-wordpress-notification-bar/21301777 http://demo.wphash.com/hashbar/
This is what I added to my "wpm-config.json" file: You could check if this could fit your needs...?
"post_types": {
"hashbar": {}
},
"options": {
"wphash_ntf_bar": {
"_wphash_notification_close_button_text": {},
"data-text": {}
},
},
@WindowsAndLinux did my wpm-config.json at https://github.com/VaLeXaR/wp-multilang/issues/83#issuecomment-443481664 work for you?
This one works prefect: https://wordpress.org/plugins/gdpr-cookie-compliance/
@soft79 I lost the account I initially made the post with, it didn't work, I used another plugin in the end, this one https://wordpress.org/plugins/popups/ and it worked well. Thank you for your assistance.