I’m a begginer but I have my personal blog made entirely in html and I want to display multiple languages.
I’ve searched on how to do it but what they tea how to make the machine translate it, but I want to translate them manually so it doesn’t feel odd. How could I do that?
I thought on placing the translated documents in separate folders (like spanish in es folder for example) but I don’t know how could I place the link to the translated page. For example, when in an english (default language) post, change to the translated post instead of the spanish index.
2
Answers
Yes. That’s all there is to it.
<a href="/es/foo">Spanish (<span lang="es">Española</span>)</a>
at its most basic.<a href="/es/foo" rel="alternate" hreflang="es">Spanish (<span lang="es">Española</span>)</a>
would be better.You can use a sub-domain (
http://us-en.my-blog.com
) or top-level sub-directory (http://my-blog.com/us-en
). Under the first approach, you simply make your links relative (/my-other-page.html
). Then your links will always take you to pages under the same language translation.So, for instance, if you are on the page
http://us-en.my-blog.com/
and click the link with the relative address/about.html
, then the browser will navigate tohttp://us-en.my-blog.com/about.html
If, on the other hand, you go with a top-level sub-directory, then you will be required to include the language in the url (
/us-en/my-other-page.html
).So, for instance, if you are on the page
http://my-blog.com/us-en
and click the link with the relative address/us-en/about.html
, then the browser will navigate tohttp://my-blog.com/us-en/about.html
. Be careful not to forget the/us-en
prefix in your relative urls with this approach.Hope that helps 🙂