Allow configuring <html lang> via html-lang file#92
Allow configuring <html lang> via html-lang file#92MavenRain wants to merge 2 commits intolamdera:lamdera-nextfrom
Conversation
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 <> "\">" |
There was a problem hiding this comment.
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
|
I don’t think this solves the problem fully. What if you have a multi-lingual Lamdera app where you can change the language? |
Yup it seems that it doesn't help, my app handles 12 languages, I really need this to be fixed |
Prevents attribute injection via the html-lang file by escaping &, ", <, > as HTML entities. Addresses PR review feedback from lydell.
I think this might be a bit more involved than a simple code fix. I'm wondering if a JS approach or Elm port message might be more appropriate for dynamic lang updates. |
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.