lang-attribute
Qué hace
Esta skill comprueba que una página declare bien su idioma y que las partes escritas en otro idioma estén marcadas. Es para desarrolladores y editores de contenido de cualquier sitio web.
Cuándo usarla
- ✓Cuando tu página no tiene idioma definido en el elemento html.
- ✓Cuando un lector de pantalla pronuncia mal tu texto.
- ✓Cuando tu página incluye fragmentos escritos en otro idioma.
Link de la skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/lang-attribute/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Puedes comprobar que mi página declare bien su idioma?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente comprueba que el elemento html tenga un valor lang válido, como en o fr-CA. También sugiere atributos lang en las secciones que cambian de idioma.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Set the page lang attribute
Screen readers select the correct text-to-speech voice and pronunciation engine based on the lang attribute. Without it, VoiceOver defaults to the user's system language, and NVDA uses its default voice — both may mispronounce words in other languages, making content unintelligible. French text read with an English voice profile is incomprehensible. The lang attribute also enables browser translation features (Chrome's Translate), hyphenation algorithms (CSS hyphens: auto), and correct spell checking. This is a WCAG Level A requirement — the most fundamental accessibility baseline.
Quick Reference
- The
<html>element must have alangattribute — WCAG 2.1 SC 3.1.1 (Language of Page, Level A) - The value must be a valid BCP 47 language tag:
en,en-US,fr,zh-Hant,ar, etc. - Use
langon individual elements to indicate language changes within the page — WCAG 2.1 SC 3.1.2 (Level AA) - The
langattribute affects screen reader pronunciation, spell checking, hyphenation, and browser translation - An empty
lang=''is treated as unknown language — equivalent to having nolangattribute
Check
Inspect the <html> element in the page source. Verify: (1) a lang attribute is present; (2) its value is non-empty; (3) its value is a valid BCP 47 language code matching the primary language of the page content (e.g., en for English, fr for French, zh-Hant for Traditional Chinese). Flag: missing lang, empty lang='', language codes using full names instead of codes (e.g., lang='english' is invalid), and mismatches where the declared language does not match the actual content language. For multilingual pages, also check for lang changes on block-level elements containing content in a different language.
Fix
Add or correct the lang attribute on the <html> element: <html lang='en'> for English, <html lang='fr'> for French, <html lang='es'> for Spanish, <html lang='de'> for German, <html lang='ja'> for Japanese, <html lang='zh-Hans'> for Simplified Chinese, <html lang='zh-Hant'> for Traditional Chinese, <html lang='ar'> for Arabic. For content sections in different languages, add lang to the containing block element. Validate language codes against the IANA Language Subtag Registry.
Explain
WCAG 2.1 SC 3.1.1 (Language of Page, Level A) requires that the default human language of each web page can be programmatically determined. The lang attribute on <html> fulfills this requirement. The value must be a BCP 47 language tag — a standardized system of subtags that identifies language, script, and region. The primary language subtag (e.g., en, fr) is required; region subtags (e.g., en-US, fr-CA) are optional but useful for dialect-specific pronunciation and spell checking. SC 3.1.2 (Language of Parts, Level AA) extends this to inline language changes within a page.
Code Review
Review templates, server-rendered HTML, and shared components that output markup related to Set the page lang attribute. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/html/lang-attribute
Preguntas frecuentes
¿Por qué importa lang para los lectores de pantalla?
La skill indica que los lectores lo usan para elegir la voz y la pronunciación correctas.
¿Qué valor es válido?
Un código de idioma BCP 47 válido, como en, en-US, fr o zh-Hant.
¿Qué pasa si lang está vacío?
La skill indica que un lang vacío se trata igual que si no hubiera idioma definido.
Detalles
Descripción original del autor
Use when applies to all HTML documents. Check the `<html>` opening tag for a `lang` attribute with a non-empty, valid BCP 47 language code. Also check for `lang` attribute changes on individual elements when the document contains content in multiple languages (inline quotes, foreign terms, multilingual sections). The `lang` attribute is inherited — child elements inherit the language from their nearest ancestor with `lang`.
Popularidad
- Estrellas en GitHub
- 75 mil
- Posición en el ranking
- #2913
- Licencia
- MIT
- Actualizada
- 31/10/2026
Comentarios
- …
Más skills de este repositorio
frontendchecklist
75 milRevisa código frontend y páginas en vivo con más de 380 reglas de accesibilidad, velocidad, SEO y seguridad, usando una herramienta de línea de comandos.
frontend-checklist-global
75 milAudita un proyecto frontend con las 386 reglas de Front-End Checklist y ofrece una corrección concreta para cada problema encontrado.
404-page
75 milComprueba que tu página de no encontrado ofrezca enlaces útiles y devuelva un estado 404 real, para ayudar a los visitantes perdidos a encontrar su camino.
about-page
75 milRevisa si tu sitio tiene una página Sobre nosotros clara que explique quién lo dirige, para generar confianza en los visitantes y en los buscadores.
Skills parecidas
angular-developer
280 milAyuda a tu agente con código de Angular y la estructura del proyecto. Útil para empezar proyectos, crear partes de código o mejorar el rendimiento y la accesibilidad.
frontend-a11y
280 milAyuda a tu agente a hacer que las interfaces web sean accesibles para todos. Asegura que sitios y apps funcionen bien con lectores de pantalla y navegación por teclado.
frontend-patterns
280 milHace que tu agente aplique patrones modernos en desarrollo frontend. Optimiza el rendimiento, gestiona el estado y sigue buenas prácticas en React y Next.js.