Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve integration with WPML and Polylang #451

Open
Chouby opened this issue Apr 10, 2020 · 1 comment
Open

Improve integration with WPML and Polylang #451

Chouby opened this issue Apr 10, 2020 · 1 comment
Labels
bug This label could be used to identify issues that are caused by a defect in the product.

Comments

@Chouby
Copy link

Chouby commented Apr 10, 2020

The current integration with WPML is done with calls to the function icl_t() here and in a few other lines of the same file.

There are a few caveats with this way of proceeding.

  1. icl_t() is deprecated since WPML 3.2 and should be replaced by the filter wpml_register_single_string. See: https://wpml.org/wpml-hook/wpml_translate_single_string/.
  2. As you did not use the companion function icl_register_string() (also deprecated since WPML 3.2 and replaced by the action wpml_register_single_string https://wpml.org/wpml-hook/wpml_register_single_string/, you are relying on a WPML option allowing to auto-register strings. This has several issues:
    • As it's optional, you can't be sure that your strings will be registered
    • Auto-register writes to DB on frontend. Any user aware of this would deactivate this option to improve his site's performance.

Note: icl_t() works with Polylang except that we don't honor auto-register for the performance issues it causes.

I suggest to register the strings when they are saved in options. That way, you would not have to rely on the corresponding WPML option and the plugin would also work out of the box with Polylang.

@cristian-ungureanu cristian-ungureanu added the bug This label could be used to identify issues that are caused by a defect in the product. label Mar 9, 2021
@cristian-ungureanu cristian-ungureanu self-assigned this Mar 9, 2021
@cristian-ungureanu
Copy link
Contributor

@selul I don't know if we should tackle this one. It's true that icl_t function is deprecated but we are using it for ShopIsle and we retired it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This label could be used to identify issues that are caused by a defect in the product.
Projects
None yet
Development

No branches or pull requests

2 participants