Template string translation support with HTMX requests #13
jasalt
started this conversation in
Show and tell
Replies: 1 comment
-
|
WPML has action hook function that can be used in Common htmx request context aware function returning language code: Template code: Controller code for htmx requests (in Something similar should be possible with Polylang also, I hear that |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm rewriting real-time visitor monitoring functionality using HTMX API WP plugin at https://jyväskylä.hacklab.fi/en/ (visible on top of site), which updates itself every 15 seconds.
The WP i18n feature that Timber theme framework wraps works fine for initial render selecting correct language, but later during HTMX request the language resets to site default language (Finnish). This happened when the
hx-triggerpolling happens the first time:Site uses WPML for localization (theme source code here) and these strings have been translated using it's string translation feature.
WPML uses either a query parameter or url path eg.
/en/for deciding which language to render. This plugin using it's own endpoint does not hint the translation facilities about what language should be rendered and it uses site's default language.Beta Was this translation helpful? Give feedback.
All reactions