Skip Navigation

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.

This topic contains 5 replies, has 3 voices.

Last updated by Eran Helzer 1 year, 10 months ago.

Assisted by: Eran Helzer.

Author Posts
August 1, 2023 at 2:41 pm #14135491

benS-31

Tell us what you are trying to do?

Ensure the correct lang is displayed for the right language/translation.

It seems it's setup correctly in the backend, perhaps it isn't? Please see attached screenshot.

I've edited this and also re-save permalinks, but it's always showing en-GB no matter what language I'm viewing.

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?

Screenshot 2023-08-01 at 15-40-11 Languages ‹ Cirrus Research — WordPress.png
August 2, 2023 at 8:35 am #14139917

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

1) In order to expedite handling your support requests, can you please share WPML support debug information from your site.

- To give debug information, login to your site and go to WPML → Support. From there click on the “debug information” link at the bottom of the page.
- Once on the “debug information” page, select the entire content of the text box and copy it.
- Now go back to our support forum, find debug information box and paste it.

More information on the link: https://wpml.org/faq/provide-debug-information-faster-support/

2) Please share URL to an example page where I can check and see the issue with HTML lang.

Thanks,
Drazen

August 2, 2023 at 8:50 am #14140071

benS-31

Thanks.

You can find the html lang issue info on any page on hidden link

<html <?php language_attributes(); ?> class="h-100"> <--- no matter which language page you're on it always shows en-GB...

.htaccess info:

cirrusadmin
CRL3tme!n

August 2, 2023 at 12:20 pm #14142087

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Please try to follow our documentation on how to get the current language, here:
https://wpml.org/faq/how-to-get-current-language-with-wpml/

A possible use of the hook would be:

$my_current_lang = apply_filters( 'wpml_current_language', NULL );

Please update me on if this is what you were looking for.

August 3, 2023 at 9:18 am #14147311

benS-31

Hi,

$my_current_lang = apply_filters( 'wpml_current_language', NULL );

This only returns the single, not the full locale e.g.

It returns 'de' not de_DE or 'en' and not en_GB.

I use another site with wpml and...

<?php language_attributes(); ?>

...works as intended, but on the website i'm currently working on, whatever language you're visiting, it only shows the en_GB locale.

So I need some pro assistance as to how to fix it, my previous/original message + screenshot show that they are set up correctly per language in the backend (or so I think!), but it's not quite working as intended.

I look forward to a response.

August 3, 2023 at 11:43 am #14149101

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Yes, I understand.

I took a look again at your site, and it seems like the correct language code is now showing.

Have you changed something that fixed this?