mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-06-17 18:42:04 +02:00
Fix language attribute of top level html tag (#1705)
Sets aka "fixes" the language attribute of the top level html tag. This was hard coded to 'en' before, what led to bad experiences with screen readers. We now set overwrite the attribute with the language from i18next.
This commit is contained in:
2
gradle/changelog/html_language_tag.yaml
Normal file
2
gradle/changelog/html_language_tag.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Language tag of top level html element ([#1705](https://github.com/scm-manager/scm-manager/pull/1705))
|
||||
@@ -29,6 +29,7 @@ import ScrollToTop from "./ScrollToTop";
|
||||
import IndexErrorPage from "./IndexErrorPage";
|
||||
import { useIndex } from "@scm-manager/ui-api";
|
||||
import { Link } from "@scm-manager/ui-types";
|
||||
import i18next from "i18next";
|
||||
|
||||
const Index: FC = () => {
|
||||
const { isLoading, error, data } = useIndex();
|
||||
@@ -36,6 +37,10 @@ const Index: FC = () => {
|
||||
|
||||
// TODO check componentDidUpdate method for anonymous user stuff
|
||||
|
||||
i18next.on("languageChanged", (lng) => {
|
||||
document.documentElement.setAttribute("lang", lng);
|
||||
});
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user