Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 views
in Technique[技术] by (71.8m points)

html - Can I use custom language / country code combinations in hreflang?

I'm internationalizing a large website in 14 languages.

I have found that some of the language/countries we want to target do not have lang-cc entries in various lists, e.g. dot net cultures, language-codes-and-iso-country-codes-for-html5.

As an example, Danish is widely spoken in Greenland.

We are translating our site in to Danish for users in Denmark.

It therefore makes sense to offer the translated content to Danish speakers in Greenland, however the lang/country code for this is not listed in resources we have found (especially as Google Greenland exists - google.gl).

So, can we safely use da-gl in hreflang and as a sub directory to target Danish speakers in Greenland even though that combination is not listed in the various resources we've found?

(Please note that we can't simply redirect users from Greenland to the Danish version targeted at Denmark as there are differences in currency and shipping prices, and we are trying to avoid any IP based redirection / content customisation.)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is no list of "valid" combinations, as nobody can (nor should!) define which languages are spoken in which regions, or which linguistic variations exist.

HTML5 defines which content the hreflang attribute can have:

On Webmasters SE, I explained what this means (for the lang attribute, but it’s the same for hreflang): my answer to "Where do I get a list of attribute 'lang' values - what standard covers this, for SEO optimization?"

As you see, you only have to follow the rules from BCP 47 and choose tags from the Language Subtag Registry.

Thus da-GL is a valid value for hreflang/lang:

  1. da is the subtag for the language Danish
  2. - is the subtag separator
  3. GL is the subtag for the region Greenland

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...