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 7 replies, has 2 voices.

Last updated by magnusJ-3 7 months, 2 weeks ago.

Assigned support staff: Bobby.

Author Posts
October 1, 2019 at 1:16 pm #4672309


I have created a custom Swedish language because I want the Swedish version of my site to be .com/se (and not the wpml standard .com/sv)

My custom Swedish language has Default locale "Se_se" and hreflang "se". But the standard for Swedish language i guess is "Se_sv" and "sv", is that right?

I will create SEO for Swedish on this part of the site. But will Google recognise my language as Swedish, which of course is a must for the SEO, or should I change something in my custom settings?

See previous post for settings etc.

October 1, 2019 at 2:52 pm #4673091


I guess "se-se" means "northern sami" and not swedish.
What if I set the default locale to "sv-SE" and hreflang to "sv-se"?
(Instead of the wpml standard default locale "sv_SE" which is already taken by wpml?)
Will that work for both google and wpml?

All the best,

October 1, 2019 at 5:30 pm #4674395


Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi There,

Please follow the steps below to resolve this issue and assign the correct default locale to your custom WPML language:

1. Go to WPML->languages-> If Swedish by WPML is not added, add a new language and add it along with your custom language -> Edit languages
2. Edit the default locale of the WPML Swedish and change the default locale to "se-se" along with the href lang to "se" and save.
3. Edit the new custom language and now add "sv_SE" for default locale and "sv" for href lang and save.

Let me know your results, please.

October 2, 2019 at 11:49 am #4679911


So I basically should add the wpml swedish and rename its default locale and href lang to something else than the wpml standard values. Then I should be able to change my custom swedish default locale and href lang to the wpml standard values. Then remove the wpml swedish.

I did that and it worked fine until I tried to update the wpml plugin to see what happened when the wpml swedish settings was updated. Then the whole site chrashed.

October 2, 2019 at 5:16 pm #4682379


Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

If possible let's change one step in the above solution and let me know your results.

I have tested this on my staging environment and it worked well.

Instead of removing the Default WPML Swedish language after changing its default locale and href lang, go back to WPML->Languages->Hide Languages-> Hide the WPML Swedish language.

This will ensure that with any updates it will not revert back to its default locale as WPML will adhere to the new locale we gave it that is saved in the database.

October 3, 2019 at 3:14 pm #4689351


Thanks, but I would prefer not to just hide the active wpml language, since anyone that logs in to the site (which can be quite a few in the case) will see the hidden language aswell in their previews which will look strange. And if they happen to remove the hidden language they will crash the site. I would prefer to only have my custom Swedish and the wpml English. (And still be able to update the site.)

Does the default locale have to be exactly like the .mo and .po files for WPML to work? Or can I change my custom language default locale to "sv-SE" (instead of the wpml standard default locale "sv_SE")?

October 3, 2019 at 3:27 pm #4689399


Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

The reason the default locale is best to be sv_SE is that it is the one WordPress uses, therefore WPML is able to download the .mo files for the language.

However, you can set it to a different default locale if you wish for example sv-se, without any major issues other than WPML not being able to automatically download the .mo from WP but that should not cause issues in your translation.

October 8, 2019 at 9:02 am #4713407


Ok! My issue is resolved now. Thank you very much!