]> Untitled Git - lemmy-ui.git/commitdiff
Set html lang attr to the interface language
authorYuri Pieters <yuri@zopatista.com>
Sun, 11 Jun 2023 15:21:41 +0000 (16:21 +0100)
committerYuri Pieters <MageJohn@users.noreply.github.com>
Sun, 11 Jun 2023 23:26:01 +0000 (00:26 +0100)
src/server/index.tsx
src/shared/components/common/html-tags.tsx

index 1fab13d15a23c199420d0169d04ae0a73df6f287..b7f4fb5fc33572a3d5d2607436b881156dd7290f 100644 (file)
@@ -346,7 +346,7 @@ async function createSsrHtml(root: string, isoData: IsoDataOptionalSite) {
 
   return `
   <!DOCTYPE html>
-  <html ${helmet.htmlAttributes.toString()} lang="en">
+  <html ${helmet.htmlAttributes.toString()}>
   <head>
   <script>window.isoData = ${sanitize(JSON.stringify(isoData))}</script>
   <script>window.lemmyConfig = ${serialize(config)}</script>
index 4c673d906645db0cd3d7ad711b6b28785c1ed72a..0e6cb2d03ad381528ed3f78447e0c0bc18d2b1bf 100644 (file)
@@ -2,7 +2,7 @@ import { htmlToText } from "html-to-text";
 import { Component } from "inferno";
 import { Helmet } from "inferno-helmet";
 import { httpExternalPath } from "../../env";
-import { md } from "../../utils";
+import { getLanguages, md } from "../../utils";
 
 interface HtmlTagsProps {
   title: string;
@@ -17,9 +17,12 @@ export class HtmlTags extends Component<HtmlTagsProps, any> {
     const url = httpExternalPath(this.props.path);
     const desc = this.props.description;
     const image = this.props.image;
+    const lang = getLanguages()[0];
 
     return (
       <Helmet title={this.props.title}>
+        <html lang={lang == "browser" ? "en" : lang} />
+
         {["title", "og:title", "twitter:title"].map(t => (
           <meta key={t} property={t} content={this.props.title} />
         ))}