How to Add “lang” Attribute to a Blogger Template

Posted by Lasantha Bandara on April 5th, 2016 File Under : change template, html0 Comment

Adding the "lang" attribute into the html tag specifies the default language of the website's content. Some common lang attributes are "en" for English, "ja" for Japanese, "es" for Spanish, "fr" for France and so on.

To specify your language, go to the "Edit HTML" page of your blog.

Your blog's XML code will start with something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>

Now add lang='en-US' code into the html tag like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html lang='en-US' b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>

Note: "en-US" means English - United States. Simply change it with your language code.

Final result will look like this:

Add lang Attribute into Blogger Templates

Language Codes Table

af Afrikaans sq Albanian
ar-sa Arabic (Saudi Arabia) ar-iq Arabic (Iraq)
ar-eg Arabic (Egypt) ar-ly Arabic (Libya)
ar-dz Arabic (Algeria) ar-ma Arabic (Morocco)
ar-tn Arabic (Tunisia) ar-om Arabic (Oman)
ar-ye Arabic (Yemen) ar-sy Arabic (Syria)
ar-jo Arabic (Jordan) ar-lb Arabic (Lebanon)
ar-kw Arabic (Kuwait) ar-ae Arabic (U.A.E.)
ar-bh Arabic (Bahrain) ar-qa Arabic (Qatar)
eu Basque (Basque) bg Bulgarian
be Belarusian ca Catalan
zh-tw Chinese (Taiwan) zh-cn Chinese (PRC)
zh-hk Chinese (Hong Kong SAR) zh-sg Chinese (Singapore)
hr Croatian cs Czech
da Danish nl Dutch (Standard)
nl-be Dutch (Belgium) en English
en-us English (United States) en-gb English (United Kingdom)
en-au English (Australia) en-ca English (Canada)
en-nz English (New Zealand) en-ie English (Ireland)
en-za English (South Africa) en-jm English (Jamaica)
en English (Caribbean) en-bz English (Belize)
en-tt English (Trinidad) et Estonian
fo Faeroese fa Farsi
fi Finnish fr French (Standard)
fr-be French (Belgium) fr-ca French (Canada)
fr-ch French (Switzerland) fr-lu French (Luxembourg)
gd Gaelic (Scotland) ga Irish
de German (Standard) de-ch German (Switzerland)
de-at German (Austria) de-lu German (Luxembourg)
de-li German (Liechtenstein) el Greek
he Hebrew hi Hindi
hu Hungarian is Icelandic
id Indonesian it Italian (Standard)
it-ch Italian (Switzerland) ja Japanese
ko Korean ko Korean (Johab)
lv Latvian lt Lithuanian
mk Macedonian (FYROM) ms Malaysian
mt Maltese no Norwegian (Bokmal)
no Norwegian (Nynorsk) pl Polish
pt-br Portuguese (Brazil) pt Portuguese (Portugal)
rm Rhaeto-Romanic ro Romanian
ro-mo Romanian (Republic of Moldova) ru Russian
ru-mo Russian (Republic of Moldova) sz Sami (Lappish)
sr Serbian (Cyrillic) sr Serbian (Latin)
sk Slovak sl Slovenian
sb Sorbian es Spanish (Spain)
es-mx Spanish (Mexico) es-gt Spanish (Guatemala)
es-cr Spanish (Costa Rica) es-pa Spanish (Panama)
es-do Spanish (Dominican Republic) es-ve Spanish (Venezuela)
es-co Spanish (Colombia) es-pe Spanish (Peru)
es-ar Spanish (Argentina) es-ec Spanish (Ecuador)
es-cl Spanish (Chile) es-uy Spanish (Uruguay)
es-py Spanish (Paraguay) es-bo Spanish (Bolivia)
es-sv Spanish (El Salvador) es-hn Spanish (Honduras)
es-ni Spanish (Nicaragua) es-pr Spanish (Puerto Rico)
sx Sutu sv Swedish
sv-fi Swedish (Finland) th Thai
ts Tsonga tn Tswana
tr Turkish uk Ukrainian
ur Urdu ve Venda
vi Vietnamese xh Xhosa
ji Yiddish zu Zulu

File Under : change template, html

Leave a Reply