Skip to content

Allow configuring <html lang> via html-lang file#92

Open
MavenRain wants to merge 1 commit intolamdera:lamdera-nextfrom
MavenRain:feat/html-lang-attribute
Open

Allow configuring <html lang> via html-lang file#92
MavenRain wants to merge 1 commit intolamdera:lamdera-nextfrom
MavenRain:feat/html-lang-attribute

Conversation

@MavenRain
Copy link
Copy Markdown

Read an optional html-lang file from the project root to set the lang attribute on the generated tag. If the file contains e.g. "fr", the output becomes . If absent or empty, the tag is plain as before. Fixes #84.

  Read an optional html-lang file from the project root to set the
  lang attribute on the generated <html> tag.  If the file contains
  e.g. "fr", the output becomes <html lang="fr">.  If absent or empty,
  the tag is plain <html> as before.  Fixes lamdera#84.
let trimmed = T.strip lang in
if T.null trimmed
then "<html>"
else "<html lang=\"" <> T.encodeUtf8Builder trimmed <> "\">"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should HTML-escape the value. Otherwise people will end up writing stuff like this in the file:

en" other-attribute="i want it" third="yes

@lydell
Copy link
Copy Markdown
Contributor

lydell commented Apr 1, 2026

I don’t think this solves the problem fully. What if you have a multi-lingual Lamdera app where you can change the language?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow configuring <html lang> attribute

2 participants