Files
pterodactyl-panel/resources/scripts/components/admin/languageOptions.ts
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

13 lines
507 B
TypeScript

import type { AdminLanguages } from '@/api/admin/languages/queries';
import type { SelectOption } from '@/components/ui/Select';
export const languageOptions = (languages: AdminLanguages | undefined, current?: string): SelectOption[] => {
const options = Object.entries(languages ?? {}).map(([value, label]) => ({ value, label }));
if (current && !options.some((option) => option.value === current)) {
return [{ value: current, label: current }, ...options];
}
return options;
};