This thread is resolved. Here is a description of the problem and solution.
Problem:
You are experiencing an issue where the time format on your WordPress site is displaying in English (e.g., 4:30 pm) instead of the desired 24-hour format (H:i) despite the WordPress settings being correctly set.
Solution:
We resolved this by adding a custom function to your theme's functions.php file. We recommend creating a child theme and moving this function there to avoid it being overwritten during theme updates. Here is the function you should use:
add_filter('gettext', 'wpml_date_format_multilingual', 10, 3);<br /><br />function wpml_date_format_multilingual($translated, $original, $domain) {<br /> if ($domain !== 'sitepress' || !is_admin()) {<br /> return $translated;<br /> }<br /> if ($original !== 'g:i a T' && $original !== 'F j, Y') {<br /> return $translated;<br /> }<br /> $current_lang = apply_filters('wpml_current_language', NULL);<br /> if ($original === 'F j, Y') {<br /> switch ($current_lang) {<br /> case 'de':<br /> return 'j. F Y';<br /> case 'cs':<br /> return 'j. F Y';<br /> case 'fr':<br /> return 'j F Y';<br /> case 'es':<br /> return 'j \d\e F \d\e Y';<br /> }<br /> }<br /> if ($original === 'g:i a T') {<br /> switch ($current_lang) {<br /> case 'de':<br /> case 'cs':<br /> case 'fr':<br /> case 'es':<br /> return 'H:i T';<br /> }<br /> }<br /> return $translated;<br />}
If this solution does not apply to your case, or if it becomes outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.