libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

Add multilingual support for success messages #72

Closed k1sul1 closed 7 years ago

k1sul1 commented 7 years ago

Originally shipped without because it was supposed to be hard. It wasn't.

k1sul1 commented 7 years ago

@anttiviljami what do you think?

Are the filter names ok or does anyone have better ideas?

k1sul1 commented 7 years ago

One thing; class.wplf-polylang.php is quite repetitive, could we do something about that in the near future?

anttiviljami commented 7 years ago

I get Fatal error: Uncaught Error: Call to undefined function pll_current_language() after applying this patch without polylang.

Fix pls. :)

Otherwise looks great!

anttiviljami commented 7 years ago

Also, might want to make sure the call to pll_current_language() comes after the plugins_loaded hook. wp-libre-form might get loaded before and this will cause a 500 fatal error

k1sul1 commented 7 years ago

👍 I'll look into this tomorrow.

k1sul1 commented 7 years ago

pll_current_language() is called just before wp_localize_script(); it should work as is.

If I check that Polylang exists before instantiating the class the fatal should be gone.

k1sul1 commented 7 years ago

Could we use Travis to test that the plugin works with and without Polylang?

anttiviljami commented 7 years ago

We could. I'll gladly accept a PR for a test like that.

k1sul1 commented 7 years ago

😁 Not my strong suite, but maybe.

Did you notice that the Travis build errors are not even related to the last commit? Previous commit build succeeded, and the next commit is one line: https://github.com/anttiviljami/wp-libre-form/pull/72/commits/a76d1a8df263e5014defe9e3562d462b2afa20b2

anttiviljami commented 7 years ago

Must be a wpcs update. Don't worry about it. Need to fix in master so you can rebase

anttiviljami commented 7 years ago

Should be fixed now. Please rebase to master and push to run travis again for this PR

k1sul1 commented 7 years ago

That was harder than expected but should be fine now.