mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Translate modes
This commit is contained in:
parent
f2ebdc123c
commit
2f5293eb87
@ -1,5 +1,6 @@
|
|||||||
import { h } from 'preact';
|
import { h } from 'preact';
|
||||||
import { useCallback, useState } from 'preact/hooks';
|
import { useCallback, useState } from 'preact/hooks';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export default function ButtonsTabbed({
|
export default function ButtonsTabbed({
|
||||||
viewModes = [''],
|
viewModes = [''],
|
||||||
@ -9,6 +10,7 @@ export default function ButtonsTabbed({
|
|||||||
className = 'text-gray-600 py-0 px-4 block hover:text-gray-500',
|
className = 'text-gray-600 py-0 px-4 block hover:text-gray-500',
|
||||||
selectedClassName = `${className} focus:outline-none border-b-2 font-medium border-gray-500`,
|
selectedClassName = `${className} focus:outline-none border-b-2 font-medium border-gray-500`,
|
||||||
}) {
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const [selected, setSelected] = useState(0);
|
const [selected, setSelected] = useState(0);
|
||||||
const captitalize = (str) => {
|
const captitalize = (str) => {
|
||||||
return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
|
return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
|
||||||
@ -16,9 +18,9 @@ export default function ButtonsTabbed({
|
|||||||
|
|
||||||
const getHeader = useCallback(
|
const getHeader = useCallback(
|
||||||
(i) => {
|
(i) => {
|
||||||
return headers.length === viewModes.length ? headers[i] : captitalize(viewModes[i]);
|
return headers.length === viewModes.length ? headers[i] : t(viewModes[i]);
|
||||||
},
|
},
|
||||||
[headers, viewModes]
|
[headers, viewModes, t]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClick = useCallback(
|
const handleClick = useCallback(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user