Jump to content
thirty bees forum
  • 0

Hreflang not correct in multistore and iso code should be available multiple times.


Question

Posted (edited)

I noticed that the default Hreflang no is working as it should.

In my case it should be like this (one store one language):

<link rel="alternate" hreflang="nl-be" href="https://website.be/PvChi1/product1.html" />
<link rel="alternate" hreflang="nl-nl" href="https://website.nl/PvChi1/product1.html" />
<link rel="alternate" hreflang="x-default" href="https://website.nl/PvChi1/product1.html" />

Default TB makes it like:

<link rel="alternate" href="https://website.be/PvChi1/product1.html" hreflang="nl-NL">
<link rel="alternate" href="https://website.be/PvChi1/product1.html" hreflang="x-default">
<link rel="alternate" href="https://website.be/PvChi1/product1.html" hreflang="nl-BE">

Conclusion TB does not take into account multistore with multiple shop urls....

To be clear the language nl-NL is not even available in the .be store.

 

Writing this I conclude that it might also be a language issue als it seems that nl-Be is not shown in the .be store... So probably there is a more fundamental issue there. I remember that we had to manually in the BD add the language as flemisch was not allowed in PS at that time. Because TB and PS does not allow multiple iso properties. This gives the error: This ISO code is already linked to another language.

While you can have iso code nl (Netherlands, belgium) for multiple counties. Same for german (germany, austria) and french (loads of counties).

 

Edited by Smile

8 answers to this question

Recommended Posts

  • 0
Posted

1.0.8, I will test it in 1.1.0 and come back soon to the topic.

Actually there is 3 issues here which I will test:

  1. Hreflang and multistore
  2. Use iso codes multiple times
  3. Prevent store to not us a language that is not available for it.

 

  • 0
Posted

So here are the test results:

  1. Hreflang and multistore: Not working, only those can be found while we have also a nl-BE version running.
    <link rel="alternate" href="https://website.nl/PvChi2/" hreflang="nl-NL">
    <link rel="alternate" href="https://website.nl/PvChi2/" hreflang="x-default">

     

  2. Use iso codes multiple times: Still not possible in 1.1.0, see attached screenshots.
  3. Prevent store to not us a language that is not available for it. Still the store is presenting nl-NL language although it should present nl-BE language. See attached. 

 

I can give access to this test environment if needed to investigate. Or send a video....

nl store.JPG

be store.JPG

ISO-code-already-there.JPG

ISO-code.JPG

  • 0
Posted

Let's start with problem #2 -- iso code can't be used multiple times. This is valid requirement, there are many places in the codebase that expects that only one language exists for every iso code. For example, method Language::getIdByIso($iso) is used multiple times, and it returns 'id' of language. If there were two, or more, languages associated with the same iso, what id should be returned? First one? Random? None? Throw an exception??? There would be many areas that would stop working correctly (ie, problem #1)

Now, with this in mind -- how the hell did you managed to have two languages with the same iso code? Since it's not possible to achieve this from back office (problem #2)

  • 0
Posted

Well is it not a design flaw that only one iso can be used? As explained in the first topic: 

Quote

While you can have iso code nl (Netherlands, belgium) for multiple counties. Same for german (germany, austria) and french (loads of counties).

Well some agency here added it for me. I think in the DB we changed it. And seems to work kind of but not really.

 

Making the conclusion that iso can be used multiple times. Can you tell me how to add flemisch as a language? I mean iths both nl, but really different words... Alos different websites with hreflang....

Attached some DB pictures.

 

Not sure how to proceed.

DB2.JPG

DB1.JPG

  • 0
Posted

By me it's a design flaw, a World-Wide design flaw. Why? Cause ISO 3166-1 (used here) is not a language code. It is a Country code.
However, it's a common misusage. Many systems around world use Country code as Language code not taking consideration there are multiple languages in each country.

Almost all external systems will expect you to provide Country ISO code as language code.

It cannot be fixed... not quickly and without problems

Why in current system we cannot have 2 identical values in ISO:

  • Unique urls: http://example.com/{iso_lang}/
    Having 2 identical languages could call for trobule.
    Result: Could return a random or only one translation, as 2 translations have same ISO
    All people around globe are used to use 2 digit code and it's easier to use 2 digit code in url.
  • getting language id by iso "Language::getIdByIso('nl')"
    Could also result in random or only one language ID returned

These are only 2 reasons i quickly came up with.

Fixing it and forcing to use proper code could be quite troublesome. As many external systems assume that ISO code returned is an ISO alfa-2 code.

Changing/fixing it would trigger following consequences:

  • Having to change all language urls (to properly match lang="" definition)
  • Requiring all developers to adapt change to their modules. and all external systems

There is also possibility for "mixed" implementation, but that could also be troublesome.

Could  elaborate about this problems  for quite longer...

Dirty hack to achieve what you want

There is one thing I see in code.. iso languages can be 2 to 3 letter codes. You can try, to set ISO to:
nl with nl-nl
nlb with nl-be (ofcourse nlb it's not an official ISO code and SHOULD be only used internally as a hack - dont expect external modules to recognize it)

It's a hacky way, but should work. Also, don't expect any module developer would change anything to support it.

  • 0
Posted

That's an elaborate answer. Dutch and flemish seems the same indeed. Dutch is 2 times in the table.

Normally the url should be indeed nl-NL and nl-BE. But TB uses the 2 letter codes in the url, while as you acknowledge it would be better to make it nl-nl.

I think I can decide we leave flemisch for now. And better focus on improving other languages. We should use dutch also for flemisch.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...