@@ -7,14 +7,39 @@ import React from 'react';
7
7
import { useTranslation } from 'react-i18next' ;
8
8
import { supportedLanguages } from '../config' ;
9
9
10
+
11
+ /**
12
+ * Interface for the props used by the `LocaleSelect` component, which is responsible for rendering a locale selection UI.
13
+ *
14
+ * @param {boolean } [showTitle] - Optional flag to control whether the title of the locale selector is displayed. Defaults to `false`.
15
+ * @param {boolean } [showFullNames] - Optional flag to control whether to display full language names instead of language codes. Defaults to `false`.
16
+ * @param {FormControlProps } [formControlProps] - Optional properties to customize the `FormControl` component used for the locale selection.
17
+ */
10
18
export interface LocaleSelectProps {
11
19
showTitle ?: boolean ;
12
20
showFullNames ?: boolean ;
13
21
formControlProps ?: FormControlProps ;
14
22
}
15
23
16
24
/**
17
- * A UI for selecting the locale with i18next
25
+ * A component that provides a UI for selecting the locale with `i18next`, allowing users to switch languages in the application.
26
+ * It uses Material UI components such as `FormControl`, `Select`, and `MenuItem` to render a dropdown for selecting a language.
27
+ *
28
+ * @remarks
29
+ * This component displays a locale selector with support for showing either the language code or the full language name,
30
+ * depending on the `showFullNames` prop. It also listens for language changes via the `i18next` library and updates the UI accordingly.
31
+ *
32
+ * @param {LocaleSelectProps } props - The properties for the `LocaleSelect` component.
33
+ * @param {boolean } [props.showTitle] - Optional flag to show the title of the locale selection. Defaults to `false`.
34
+ * @param {boolean } [props.showFullNames] - Optional flag to show the full names of the languages instead of their abbreviations. Defaults to `false`.
35
+ * @param {FormControlProps } [props.formControlProps] - Optional props for customizing the `FormControl` component used within the selector.
36
+ *
37
+ * @returns {ReactNode } A `FormControl` component containing a `Select` dropdown for changing the app's language.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <LocaleSelect showTitle={true} showFullNames={true} />
42
+ * ```
18
43
*/
19
44
export default function LocaleSelect ( props : LocaleSelectProps ) {
20
45
const { formControlProps, showFullNames } = props ;
0 commit comments