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

Use of static variable in qtranxf_localeForCurrentLanguage() makes it incompatible with WP switch_to_locale(). #1389

Open
jsmoriss opened this issue Jan 6, 2024 · 0 comments
Labels
maybe bug Potential bug, to be investigated

Comments

@jsmoriss
Copy link

jsmoriss commented Jan 6, 2024

Describe the bug

The use of "static $locale_lang;" in qtranxf_localeForCurrentLanguage() makes that function incompatible with the WordPress switch_to_locale() feature.

To Reproduce

Steps to reproduce the behavior:

  1. Call get_locale().
  2. Use switch_to_locale() to switch to a different locale().
  3. Call get_locale().

Because of the "static $locale_lang;" in the qtranxf_localeForCurrentLanguage() filter, get_locale() will always return the old locale (because of the static variable in that filter).

Expected behavior

get_locale() should return the new locale after switching locales.

Screenshots

Debug info

Additional context

@jsmoriss jsmoriss added the maybe bug Potential bug, to be investigated label Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe bug Potential bug, to be investigated
Projects
None yet
Development

No branches or pull requests

1 participant