Language Tags in HTML - Penn State | Accessibility

文章推薦指數: 80 %
投票人數:10人

The LANG attribute is designed to signal screen readers to switch to another language. The official W3C recommendation is to declare the primary language for ... SkiptoContent LanguageTagsinHTML Synopsis UseUnicodeencodingwheneverpossible. UsetheLANGtagtomarkwordsorpassagesoftextinanotherlanguage.Thisworksformajorlanguagesonly. Considersupplementinglanguagechangeswithatextualindication(visualorhidden)toindicatewhenaforeignlanguagewordorpassageiscoming. AboutLanguageTagging TheLANGtag(i.e.thelang=""attribute)isdesignedtosignalscreenreaderspronunciationenginestoswitchtoanotherlanguage.Forthisreasonandother,taggingWebtextasbeinginaparticularlanguageisrequiredinWCAG2.0. WCAG2.0Guideline3.1.1—"ThedefaulthumanlanguageofeachWebpagecanbeprogrammaticallydetermined." Evenmorecriticalistouselanguagetaggingtosignalaswitchinlanguages. WCAG2.0Guideline3.1.2—"Thehumanlanguageofeachpassageorphraseinthecontentcanbeprogrammaticallydeterminedexceptforpropernames,technicalterms,wordsofindeterminatelanguage,andwordsorphrasesthathavebecomepartofthevernacularoftheimmediatelysurroundingtext." DeclaringPageLanguage TheLANGattributeisdesignedtosignalscreenreaderstoswitchtoanotherlanguage.TheofficialW3CrecommendationistodeclaretheprimarylanguageforeachWebpagewitha<...lang>attributeinthetag.CodesareISO-639Languagecodes,someofwhicharelistedfurtherdownonthispage. NOTE:Youmustalsodeclaretheencodingin additiontothelanguage.Thelanguageanditsscriptareindependent. DeclaringaU.S.EnglishPage(PennState) ...   DeclaringaBritishEnglishPage ...

ScreenreaderssupportingthistagcouldswitchtoaBritishaccent.   DeclaringaFrenchPage ...

ScreenreaderssupportingthistagcouldswitchtoaFrenchaccent. SwitchingLanguages Ifyouswitchlanguageswithinonepage,youcanembedtheLANGattribute inothertagssuchasaP,TD,SPAN,DIVand othertags.Forexample TestTextwithLangTags ThissentenceisindefaultAmericanEnglish. ThissentencewillbereadwithaBritishaccent. Estafraseesenespañol.(Spanish) Cettephraseestenfrançais.(French) Mae’rfrawddeghonyngNghymraeg.(Welsh–NotSupported) ViewtheCode

ThissentenceisinEnglish.

ThissentencewillbereadwithaBritishaccentEstafraseesenespañol.(Spanish)Cettephraseestenfrançais(French)Mae’rfrawddeghonyngNghymraeg.(Welshnotalwayssupported) CommonLanguageCodes TwoLettervs.ThreeLetter Thefirstsetoflanguagecodes(ISO-639)weretwolettercodes,butdidnotcovereverylanguage.Asaresult,setsofthree-lettercodes(ISO-639-2/ISO-639-3)werecreatedtocovermorelanguages. Foranylanguage,standardsindicatetousethetwo-lettercodeifitexists.Onlyuseathree-lettercodeifnoothercodeisavailable.SeetheISO639CodeTablesforacompletelistoflanguagecodesincludingtheoriginalISO-639codesandlatervariants. WesternEuropeanLanguages Thesecodesaresupportedinmanyscreenreaders,includingJAWS. Language Code Variants English en AmericanEnglish–Code:en-US BritishEnglish–Code:en-GB Spanish es CastillianSpanish–Code:es-ES MexicanSpanish–Code:es-MX OtherSpanishNationalVariants French fr CanadianFrench–Code:fr-CA OtherFrenchNationalVariants Italian it NoMajorVariations.SeeItalianPagefordialectcodes Portuguese pt BrazilianPortuguese–Code:pt-BR EuropeanPortuguese–Code:pt-PT SeePortuguesepage Non-WesternEuropeanLanguages Language Code Variants Arabic ar SeeArabicinformation Chinese zh SimplifiedChinese–Code:zh-CN TraditionalChinese–Code:zh-TW HongKong–Code:zh-HK OtherChinesevariants Hebrew he NoMajorVariants Hindi hi NoMajorVariants Japanese ja NoMajorVariants Korean ko NoMajorVariants Swahili sw NoMajorVariants AncientLanguages Language Code Variants AncientGreek grc ModernGreek:el Latin la NoMajorVariants OldEnglish ang NoMajorVariants MiddleEnglish enm NoMajorVariants SupplementalSignalsofNon-EnglishContent InadditiontousingtheLANGtag,youcanalsoincludeanindicationinthetextsothatusersofolderscreenreaderscanmanuallywithlanguages.Thiscanbedonebyspellingoutthebeginning/endofapassageinthetext(preferablyinanH1,H2tagoraspartofasetoflinks)orinthealttagofaninvisiblegraphic.   SpellingOutLanguageNameinText TranslationsofU.N.UniversalDeclarationofHumanRights Spanish|French…(Menuprovidesquick listofwherenon-Englishpassagesare).ItisstillrecommendedthattheLANGtagalsobeused. SpanishArticle1(SpellingitOut) Artículo1Todoslossereshumanosnacenlibreseigualesendignidadyderechosy,dotadoscomoestánderazónyconciencia,debencomportarsefraternalmentelosunosconlosotros. FrenchArticle1 Articlepremier Touslesêtreshumainsnaissentlibresetégauxendignitéetendroits.Ilssontdouésderaisonetdeconscienceetdoiventagirlesunsenverslesautresdansunespritdefraternité.   WithInvisibleGraphics AnoldertechniquewouldbetoaddaninvisiblegraphicandusetheALTtexttosignaltheswitchtoanotherlanguage.ItisstillrecommendedthattheLANGtagalsobeused. ViewtheCode ... TopofPage ForeignLanguage ForeignLanguage JAWSSymbols LangaugeTags WebPageLanguageTags HTMLReference


請為這篇文章評分?