55 * USAGE:
66 * - OnboardingModal: 최초 설문
77 * - ProfilePage: 조회/수정
8+ *
9+ * NOTE: title/subtitle/label 은 i18n 키로 저장.
10+ * 컴포넌트에서 t(question.titleKey) 형태로 사용.
811 */
912
1013// 설문 항목 타입
1114export interface ProfileQuestion {
1215 key : ProfileQuestionKey ;
13- title : string ;
14- subtitle : string ;
16+ titleKey : string ;
17+ subtitleKey : string ;
1518 options : ProfileOption [ ] ;
1619}
1720
1821export interface ProfileOption {
1922 value : string ;
20- label : string ;
23+ labelKey : string ;
2124 emoji : string ;
2225}
2326
@@ -32,61 +35,60 @@ export type ProfileQuestionKey =
3235export const PROFILE_QUESTIONS : readonly ProfileQuestion [ ] = [
3336 {
3437 key : 'ageGroup' ,
35- title : '나이대가 어떻게 되세요? ' ,
36- subtitle : '맞춤형 학습 콘텐츠를 위해 필요해요 ' ,
38+ titleKey : 'onboarding.age_question ' ,
39+ subtitleKey : 'onboarding.age_subtitle ' ,
3740 options : [
38- { value : '10s' , label : '10대' , emoji : '🎒' } ,
39- { value : '20s' , label : '20대' , emoji : '🎓' } ,
40- { value : '30s' , label : '30대' , emoji : '💼' } ,
41- { value : '40s+' , label : '40대 이상 ' , emoji : '🌟' } ,
41+ { value : '10s' , labelKey : 'onboarding.age_10s' , emoji : '🎒' } ,
42+ { value : '20s' , labelKey : 'onboarding.age_20s' , emoji : '🎓' } ,
43+ { value : '30s' , labelKey : 'onboarding.age_30s' , emoji : '💼' } ,
44+ { value : '40s+' , labelKey : 'onboarding.age_40s_plus ' , emoji : '🌟' } ,
4245 ] ,
4346 } ,
4447 {
4548 key : 'occupation' ,
46- title : '현재 어떤 일을 하고 계세요? ' ,
47- subtitle : '학습 목표에 맞는 추천을 드릴게요 ' ,
49+ titleKey : 'onboarding.occupation_question ' ,
50+ subtitleKey : 'onboarding.occupation_subtitle ' ,
4851 options : [
49- { value : 'student_middle' , label : '중학생 ' , emoji : '📚' } ,
50- { value : 'student_high' , label : '고등학생' , emoji : '📝' } ,
51- { value : 'student_univ' , label : '대학생' , emoji : '🎓' } ,
52- { value : 'job_seeker' , label : '취업 준비생' , emoji : '🔍' } ,
53- { value : 'worker' , label : '직장인' , emoji : '💻' } ,
54- { value : 'other' , label : '기타' , emoji : '✨' } ,
52+ { value : 'student_middle' , labelKey : 'onboarding.student_middle ' , emoji : '📚' } ,
53+ { value : 'student_high' , labelKey : 'onboarding.student_high' , emoji : '📝' } ,
54+ { value : 'student_univ' , labelKey : 'onboarding.student_univ' , emoji : '🎓' } ,
55+ { value : 'job_seeker' , labelKey : 'onboarding.job_seeker' , emoji : '🔍' } ,
56+ { value : 'worker' , labelKey : 'onboarding.worker' , emoji : '💻' } ,
57+ { value : 'other' , labelKey : 'onboarding.other' , emoji : '✨' } ,
5558 ] ,
5659 } ,
5760 {
5861 key : 'programmingExp' ,
59- title : '프로그래밍 경험이 있으신가요? ' ,
60- subtitle : '수준에 맞는 설명을 제공해 드릴게요 ' ,
62+ titleKey : 'onboarding.exp_question ' ,
63+ subtitleKey : 'onboarding.exp_subtitle ' ,
6164 options : [
62- { value : 'none' , label : '처음이에요' , emoji : '🌱' } ,
63- { value : 'less_1y' , label : '1년 미만' , emoji : '🌿' } ,
64- { value : '1_3y' , label : '1~3년' , emoji : '🌳' } ,
65- { value : '3y_plus' , label : '3년 이상' , emoji : '🏆' } ,
65+ { value : 'none' , labelKey : 'onboarding.exp_none' , emoji : '🌱' } ,
66+ { value : 'less_1y' , labelKey : 'onboarding.exp_less_1y' , emoji : '🌿' } ,
67+ { value : '1_3y' , labelKey : 'onboarding.exp_1_3y' , emoji : '🌳' } ,
68+ { value : '3y_plus' , labelKey : 'onboarding.exp_3y_plus' , emoji : '🏆' } ,
6669 ] ,
6770 } ,
6871 {
6972 key : 'learningGoal' ,
70- title : '어떤 목표로 학습하시나요? ' ,
71- subtitle : '목표에 맞는 학습 경로를 추천해 드릴게요 ' ,
73+ titleKey : 'onboarding.goal_question ' ,
74+ subtitleKey : 'onboarding.goal_subtitle ' ,
7275 options : [
73- { value : 'basics' , label : '기초부터 탄탄히' , emoji : '📖' } ,
74- { value : 'job_prep' , label : '취업/이직 준비' , emoji : '🎯' } ,
75- { value : 'skill_up' , label : '실력 향상' , emoji : '📈' } ,
76- { value : 'curiosity' , label : '호기심/재미 ' , emoji : '🎮' } ,
76+ { value : 'basics' , labelKey : 'onboarding.goal_basics' , emoji : '📖' } ,
77+ { value : 'job_prep' , labelKey : 'onboarding.goal_job_prep' , emoji : '🎯' } ,
78+ { value : 'skill_up' , labelKey : 'onboarding.goal_skill_up' , emoji : '📈' } ,
79+ { value : 'curiosity' , labelKey : 'onboarding.goal_curiosity ' , emoji : '🎮' } ,
7780 ] ,
7881 } ,
7982] as const ;
8083
8184/**
82- * value로 label 찾기 (프로필 표시용 )
85+ * value로 labelKey 찾기 (컴포넌트에서 t(key) 로 번역 )
8386 */
84- export function getProfileLabel ( key : ProfileQuestionKey , value : string ) : string {
87+ export function getProfileLabelKey ( key : ProfileQuestionKey , value : string ) : string {
8588 const question = PROFILE_QUESTIONS . find ( ( q ) => q . key === key ) ;
8689 if ( ! question ) return value ;
87-
8890 const option = question . options . find ( ( o ) => o . value === value ) ;
89- return option ?. label || value ;
91+ return option ?. labelKey ?? value ;
9092}
9193
9294/**
@@ -95,9 +97,8 @@ export function getProfileLabel(key: ProfileQuestionKey, value: string): string
9597export function getProfileEmoji ( key : ProfileQuestionKey , value : string ) : string {
9698 const question = PROFILE_QUESTIONS . find ( ( q ) => q . key === key ) ;
9799 if ( ! question ) return '' ;
98-
99100 const option = question . options . find ( ( o ) => o . value === value ) ;
100- return option ?. emoji || '' ;
101+ return option ?. emoji ?? '' ;
101102}
102103
103104/**
0 commit comments