hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import type { Gender } from "@/api/client"; |
| 2 | import type { MessageKey } from "@/i18n/messages"; |
| 3 | |
| 4 | // Backend gender enum → i18n key. The raw enum string never reaches the UI. |
| 5 | export const GENDER_LABEL_KEYS: Record<Gender, MessageKey> = { |
| 6 | female: "profile.genderFemale", |
| 7 | male: "profile.genderMale", |
| 8 | other: "profile.genderOther", |
| 9 | undisclosed: "profile.genderUndisclosed", |
| 10 | }; |
| 11 | |
| 12 | type Translate = (key: MessageKey) => string; |
| 13 | |
| 14 | /** Gender → localized label; null renders the em-dash placeholder. Shared by |
| 15 | * the profile page and the admin user detail grid. */ |
| 16 | export function genderLabel(g: Gender | null, t: Translate): string { |
| 17 | return g ? t(GENDER_LABEL_KEYS[g]) : "—"; |
| 18 | } |