0

Is there a standard way that an HTML page written in one (human) language can indicate that a translation is available in another language? I know that I can mark up some text manually, saying something like

<p>This article is also available <a href="//www.example.com/page1-es.html">in Spanish</a></p>

which will be seen by a user, but I'm wondering whether there is something in pure HTML/CSS that will trigger browser behaviour (in a browser which is suitably aware), similar to the way that some browsers offer to translate a page which may not be in the user's native language. I'm after a solution that works in a stateless way, i.e the translations will be at alternative URLs on a per-language basis, with those translations already having been prepared by me.

Note that this mechanism by which a browser offers a translation doesn't fit my needs because a) those are typically machine translations, and b) I wish it to apply in the cases whereby a user might choose to read a page in languages other than their own, as would be the case in a language-learning context.

To be clear: I'm not asking about the mechanism by which some sites have a per-user preference for language, such that a given URL will render differently based on the value of that user setting. The solution I'm after needs to work for a static site.

2
  • 3
    I'm not sure something like this exists. There is the lang attribute. This can be used in links: <a href="#" lang="de">Deutsch</a>. This is similar to the hreflang attribute. You do indicate a language with it. Commented Sep 26 at 18:59
  • 1
    Also make sure you update your sitemap with this so people searching for whatever you have on you page in their panguage will see that page in Google Commented Sep 27 at 8:33

2 Answers 2

0

There is no method that I have been able to find that is other than effectively manually adding markup as in your example above. Anything I've ever seen is essentially stylistic variations on the manual markup, e.g., putting the link on a small image of a national flag for a country that uses the target language, or using the ISO language/culture code, or writing "Read this page in Elbonian", but with the entire sentence translated into Elbonian.

Sign up to request clarification or add additional context in comments.

Comments

0

Thanks to KIKO Software for the pointer to the hreflang attribute; I'd not come across that before. Using this and a response (to a post I made elsewhere) recommending an attribute of rel=alernate, I'm using the following technique

<a href="article-es.html" rel="alternate" hreflang="es">...</a>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.