Open
Conversation
Member
Author
|
Example output: |
cpeel
reviewed
Mar 13, 2026
Find the main document language (<html lang="xx"). Report as the main document language. Find any lang="xx" tag anywhere in the document, report a list of found languages. Use IANA lang subtag registry to provide friendly names. Also used to help validate languages - any language code not found in the registry is flagged as a warning so the user can double-check it's correct. Add a script to build JSON file from IANA lang subtag registry; pphtml uses the pre-built JSON.
36cbbf0 to
61b514c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Find the main document language (
<html lang="xx") and report it.Find any
lang="xx"tag anywhere in the document, report a list of found languages.Use the IANA lang subtag registry to provide friendly names (
en→English). Also used to help validate languages: if the language code isn't found in the registry, it's flagged for review.This feature is a rough port (with improvements) from the PPtools site's HTML check tool.
Testing Notes:
Main language:
A document has only ONE main language, defined in the
<html>tag.langattribute on the<html>tag and check the main language changes.cx): main language should be marked WARNlangattribute: main language should be marked FAIL<html xml:lang="en" lang="en" ...>Secondary languages:
Any HTML tag may have a
langattribute (per the HTML spec). Addlangattributes anywhere you like. A list of all found languages should be produced in the report.langthat's the same language as the main document. It should appear in the report.langthroughout the document, they should be reported.langis used on multiple HTML elements, it will only be reported once.langon the same line of the file to ensure they're all found.fr (French)).