Hendrik Lersch
Forum Replies Created
-
Ok, i have to correct me. It still uses the backend user locale, when retrieving data via admin-ajax.php. The permalinks are all correctly rewritten matching the chosen language in the frontend, but the texts are not translated.
Only if i choose “site default” language in the users backend profile, it will adapt the frontend language, otherwise any translatable string within the ajax content will use the language, which is set in the current users profile, regardless of which language is set in frontend.
I don’t know if you can do anything against this problem but i can’t even use the REST api, because these ajax scripts i use are large and i don’t want to rewrite them all ??
Thanks. Works like a charm ??
Yes, i don’t really have a problem with that, but it’s just not very comfortable especially for unexperienced users.
Maybe you should write a better documentation about configuring your plugin. And it would be great if you could parse the config files without force the user to change the theme or update plugins. Can’t you just check the files and parse them only if they have changed?
But thats complaining on a high level. I’m very thankful for this piece of code ??
Awesome, thank you.
Preparing the ajax url like this:add_query_arg( 'lang', wpm_get_user_language(), admin_url( 'admin-ajax.php' ) )
works very well for now. ??Ok, it’s because admin-ajax.php is in /wp-admin/ and therefore it not uses the sites locale. As a workaround i send the current locale as a parameter to the ajax script and use
switch_to_locale( $_POST['locale'] );
But i still have to use
wpm_translate_url( get_permalink( $post_id ) );
to get the correct localized url.A cleaner inbuilt solution would be nice ??
So.. found the reason and published an update. It should now work properly ??
Good that these problems have now occured, so i can implement the fixes into the next milestone version 0.5.0, which is an almost complete rewrite of the plugin, with a new ajax driven UI and more features. It will be released within the next two months. Hope you will like it ??Hey Dan,
no bugfix, which not produce new bugs ??
I have installed woocommerce in my test environment and could reproduce the error you describe. I’ll try to fix it soon.I have just released an update. Localized data will now be used dynamically and not from the database. Please let me know, if anything doesn’t work as expected.
- This reply was modified 7 years, 8 months ago by Hendrik Lersch.
- This reply was modified 7 years, 8 months ago by Hendrik Lersch.
- This reply was modified 7 years, 8 months ago by Hendrik Lersch.
Ok, i have looked into it and it unfortunately requires a bigger rewrite than i thought. I will publish an updated version as soon as possible.
Hi Ralf,
thanks for your question. This is indeed a problem, which i haven’t thought about before.I will try to find a solution for this. Maybe it’s not even necessary to store localized data into the database, because if the associated script will not be enqueued, the localized data will also not appear.
I’ve had my reasons to store it in the DB in the first place, because i deregister all scripts and styles before i register them again. This was the only way to make it possible to move stylesheets into the footer. Maybe i could scripts exclude from this.
I will check this later today and answer you soon.
Forum: Plugins
In reply to: [WP Scripts & Styles Optimizer] Cannot load page scripts/stylesYou’re welcome.
Glad to hear that i could solve your problem. ??Forum: Plugins
In reply to: [WP Scripts & Styles Optimizer] Plugin breaks in specific conditionsHi,
i’m sry, but i can’t really find anything in the code you’ve posted, which could lead to any conflicts with my plugin.I’m pretty sure, if there’s a code that breaks my plugin, it’s anywhere else in the source code of genesis. At the bottom it looks like the genesis main init function. So the conflict could be anywhere. But since genesis is not free, i can’t look inside it’s source code.
Maybe you should try it the other way around and ask the genesis support for help. Or you post in their forums. Maybe a user there has a possible solution.
Forum: Plugins
In reply to: [WP Scripts & Styles Optimizer] Cannot load page scripts/stylesHello,
some servers may refuse requests if no useragent value is transmitted. I have released a new version to address this issue. Please update the plugin and let me know if it solves your problem.Thank you very much for the 5 stars! ??
I hope this plugin continues to be supported by the author and that the features are enhanced as well.
It will definitely. Next version (0.5.0) will be a massive step in terms of usability and functionality. I’m working on it right now and using the new interface is a very smooth experience in my opinion. Hope you will like it too.. ??
Are there any Javascript errors in your browser console (F12)?
Maybe you have to delete your browser cache or reload the site with CTRL + F5.