lang
metadata
Declare lang
metadata to specify the primary language in an Aneamal file or quotation block. This is done by assigning a language tag such as en
for English or de
for German to the lang
metadata name.
Benefits of a lang
metadata declaration include:
- It helps search engines to offer search results that the users understand.
- It tells automatic translators from which source language to translate to a user-chosen target language.
- It helps screen readers to pronounce the text correctly.
- It can be used for styling, for example to use adequate fonts for different alphabets or to display the correct language-specific quotation symbols for a quoted string.
- It tells Aneamal modules in which language they shall respond. A search module could say
5 results for Roman
on an English page, but5 Ergebnisse für Roman
on a German page instead. - It can enable spelling and grammar checkers to work correctly.
The language tag can contain information on language varieties such as en-us
for US-American English or de-ch
for Swiss German. It is usually better to keep it simple than to be overly specific though. Make it as short as possible unless more details are necessary to distinguish different parts of a document.
You can find language tags in the IANA Language Subtag Registry. Search for the English name of the desired language there. German, for instance, is listed as German
instead of as Deutsch
, which would be the German name for German.
Examples
@ lang: en
The first example above specifies that the file is written in English. The second example marks the content of a quotation block as German:
> @ lang: de
> Ich bin ein Berliner.
For developers
If lang
metadata is declared, the Aneamal Translator adds a HTML lang attribute in its HTML output. The lang attribute for a webpage’s main file is added to the HTML html element.
<html lang='en'>
In the second example the lang attribute is added to the HTML blockquote element representing the quotation block:
<blockquote lang='de'>
<p>Ich bin ein Berliner.</p>
</blockquote>