HTML लैंग्वेज कोड्स
In this page:
lang एट्रिब्यूट
lang attribute आपके opening html tag के अंदर इस्तेमाल होता है ताकि आपके webpage की primary language डिक्लेयर हो सके, जो accessibility और search engine optimization दोनों के लिए ज़रूरी है।
उदाहरण: The lang Attribute
<html lang="en">
</html>
स्टैंडर्ड दो-अक्षर वाले लैंग्वेज कोड्स
HTML webpage की भाषा तय करने के लिए standard दो-अक्षर वाले ISO 639-1 language codes (जैसे English के लिए en, Spanish के लिए es, या German के लिए de) इस्तेमाल करता है।
उदाहरण: Standard Two-Letter Language Codes
<html lang="es">
</html>
रीजनल लैंग्वेज वेरिएंट्स तय करना
भाषाओं में अक्सर regional variations होते हैं। आप अपने language tag में दो-अक्षर वाला ISO 3166-1 country code (जैसे American English के लिए en-US, या British English के लिए en-GB) जोड़कर ये variations बता सकते हैं।
उदाहरण: Specifying Regional Language Variants
<html lang="en-US">
</html>
एक्सेसिबिलिटी और लैंग्वेज कोड्स
जब visually impaired users कोई webpage खोलते हैं, तो screen readers सही उच्चारण voice चुनने के लिए आपका lang attribute इस्तेमाल करते हैं। अपनी site को accessible बनाए रखने के लिए सही language codes डिक्लेयर करना ज़रूरी है।
उदाहरण: Accessibility and Language Codes
<p lang="fr">Bonjour tout le monde</p>
SEO और अनुवाद के फ़ायदे
सर्च इंजन आपका lang attribute इस्तेमाल करके आपके pages relevant देशों के users तक पहुँचाते हैं। browsers भी इस tag का इस्तेमाल करके दूसरी भाषाओं में pages लोड होने पर अपने आप translation banners दिखाते हैं।
उदाहरण: SEO and Translation Benefits
<html lang="de">
<title>Willkommen</title>
</html>
- अपने opening html tag के अंदर lang attribute शामिल करना भूल जाना।
- non-standard या गलत spelling वाले language codes इस्तेमाल करना जिन्हें browsers parse नहीं कर पाते।
- country codes को lowercase letters में लिखना या उन्हें hyphens के बजाय underscores से अलग करना।
- lang attribute आपके opening html tag के अंदर आपके webpage की primary language declare करता है।
- standard two-letter ISO 639-1 language codes इस्तेमाल करें, regional variations के लिए एक two-letter country code जोड़ते हुए।
- screen readers को foreign words सही उच्चारण के साथ पढ़ने में मदद करने के लिए specific tags पर local lang attributes लागू करें।
standard language codes और attributes सभी modern web browsers द्वारा natively supported हैं।
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: