diff --git a/src/app/[lang]/(mods-pages)/courses/ClasssRefinementItem.tsx b/src/app/[lang]/(mods-pages)/courses/ClasssRefinementItem.tsx
index 7284497e..4c8e4d33 100644
--- a/src/app/[lang]/(mods-pages)/courses/ClasssRefinementItem.tsx
+++ b/src/app/[lang]/(mods-pages)/courses/ClasssRefinementItem.tsx
@@ -108,9 +108,9 @@ const ClassRefinementItem = ({
"All"
) : (
- {selected.map((i) => (
+ {selected.map(i =>
- {getFormattedClassCode(i, selectedSemester)}
+ {getFormattedClassCode(i, selectedSemester, 'zh')}
))}
@@ -121,7 +121,6 @@ const ClassRefinementItem = ({
)}
-
{searchable && (
@@ -164,7 +163,7 @@ const ClassRefinementItem = ({
/>
- {getFormattedClassCode(item.label, selectedSemester)}
+ {getFormattedClassCode(item.label, selectedSemester, 'zh')}
{item.count}
diff --git a/src/components/CourseDetails/CourseDetailsContainer.tsx b/src/components/CourseDetails/CourseDetailsContainer.tsx
index 9a69b2df..51b630e6 100644
--- a/src/components/CourseDetails/CourseDetailsContainer.tsx
+++ b/src/components/CourseDetails/CourseDetailsContainer.tsx
@@ -500,7 +500,7 @@ const CourseDetailContainer = async ({
href={`/${lang}/courses?nthu_courses%5BrefinementList%5D%5Bcompulsory_for%5D%5B0%5D=${course.compulsory_for}`}
>
- {getFormattedClassCode(m, course.semester)}
+ {getFormattedClassCode(m, course.semester, lang)}
))}
@@ -519,7 +519,7 @@ const CourseDetailContainer = async ({
href={`/${lang}/courses?nthu_courses%5BrefinementList%5D%5Belective_for%5D%5B0%5D=${course.elective_for}`}
>
- {getFormattedClassCode(m, course.semester)}
+ {getFormattedClassCode(m, course.semester, lang)}
))}
diff --git a/src/const/class_code.ts b/src/const/class_code.ts
new file mode 100644
index 00000000..2aca8a30
--- /dev/null
+++ b/src/const/class_code.ts
@@ -0,0 +1,1010 @@
+export const classCode = [
+ {
+ "code": "AES",
+ "name_zh": "分環所",
+ "name_en": "Institute of Analytical and Environmental Sciences",
+ "code_zh": "分環所"
+ },
+ {
+ "code": "AIIM",
+ "name_zh": "AI智造暨聯網產碩專班",
+ "name_en": "Industrial Technology Graduate Program of AI Intelligent Manufacturing & Intelligent IoT Production",
+ "code_zh": "AI智造暨聯網產碩專班"
+ },
+ {
+ "code": "AMEV",
+ "name_zh": "電動載具先進製造產碩",
+ "name_en": "Advanced Intelligent Manufacture for Electric Vehicle Master Program",
+ "code_zh": "電動載具先進製造產碩專班"
+ },
+ {
+ "code": "ANTH",
+ "name_zh": "人類所",
+ "name_en": "Anthropology",
+ "code_zh": "人類所"
+ },
+ {
+ "code": "ANTU",
+ "name_zh": "人類所與交大合作課程",
+ "name_en": "Anthropology and NCTU",
+ "code_zh": "人類所"
+ },
+ {
+ "code": "ASTR",
+ "name_zh": "天文所",
+ "name_en": "Astronomy",
+ "code_zh": "天文所"
+ },
+ {
+ "code": "BAI",
+ "name_zh": "智慧生醫博士學位學程",
+ "name_en": " ",
+ "code_zh": "智慧生醫博士學程"
+ },
+ {
+ "code": "BME",
+ "name_zh": "醫工所",
+ "name_en": "Biomedical Engineering",
+ "code_zh": "醫工所"
+ },
+ {
+ "code": "BMES",
+ "name_zh": "醫環系",
+ "name_en": "Biomedical Engineering and Environmental Sciences",
+ "code_zh": "醫環系"
+ },
+ {
+ "code": "CF",
+ "name_zh": "大學中文",
+ "name_en": "College Chinese",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "CHE",
+ "name_zh": "化工系",
+ "name_en": "Chemical Engineering",
+ "code_zh": "化工系"
+ },
+ {
+ "code": "CHEM",
+ "name_zh": "化學系",
+ "name_en": "Chemistry",
+ "code_zh": "化學系"
+ },
+ {
+ "code": "CHSS",
+ "name_zh": "人社院",
+ "name_en": "College of Humanities & Social Sciences",
+ "code_zh": "人社院學士班"
+ },
+ {
+ "code": "CL",
+ "name_zh": "中文系",
+ "name_en": "Chinese Literature",
+ "code_zh": "中文系"
+ },
+ {
+ "code": "CLC",
+ "name_zh": "華語中心",
+ "name_en": "Chinese Language Center",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "CLU",
+ "name_zh": "中文系與交大合作課程",
+ "name_en": "Chinese Literature and NCTU",
+ "code_zh": "中文系"
+ },
+ {
+ "code": "COM",
+ "name_zh": "通訊所",
+ "name_en": "Communications Engineering",
+ "code_zh": "通訊所"
+ },
+ {
+ "code": "CS",
+ "name_zh": "資工系",
+ "name_en": "Computer Science",
+ "code_zh": "資工系"
+ },
+ {
+ "code": "CSR",
+ "name_zh": "半導體研究學院",
+ "name_en": "College of Semiconductor Research",
+ "code_zh": "半導體學院"
+ },
+ {
+ "code": "CTM",
+ "name_zh": "科管院",
+ "name_en": "College of Technology Management",
+ "code_zh": "科管院學士班"
+ },
+ {
+ "code": "DL",
+ "name_zh": "遠距課(同步/非同步)",
+ "name_en": "Distance Learning",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "DMS",
+ "name_zh": "醫科系",
+ "name_en": "Medical Science",
+ "code_zh": "醫科系"
+ },
+ {
+ "code": "E",
+ "name_zh": "工學院",
+ "name_en": "College of Engineering",
+ "code_zh": "工學院學士班"
+ },
+ {
+ "code": "ECON",
+ "name_zh": "經濟系",
+ "name_en": "Economics",
+ "code_zh": "經濟系"
+ },
+ {
+ "code": "EE",
+ "name_zh": "電機系",
+ "name_en": "Electrical Engineering",
+ "code_zh": "電機系"
+ },
+ {
+ "code": "EECS",
+ "name_zh": "電資院學士班",
+ "name_en": "Undergraduate Program of Electrical Engineering and Computer Science",
+ "code_zh": "電資院學士班"
+ },
+ {
+ "code": "EMBA",
+ "name_zh": "高階經營管理碩士專班",
+ "name_en": "Executive Master of Business Administration",
+ "code_zh": "EMBA專班"
+ },
+ {
+ "code": "EMD",
+ "name_zh": "EMBA雙聯學位學程",
+ "name_en": " ",
+ "code_zh": "EMBA雙聯"
+ },
+ {
+ "code": "EMIM",
+ "name_zh": "智慧製造高階在職專班",
+ "name_en": "Executive Cross-Discipline Master Program for Intelligent Manufacturing",
+ "code_zh": "智慧製造高階在職學位學程"
+ },
+ {
+ "code": "EMM",
+ "name_zh": "EMBA亞太馬國境外專班",
+ "name_en": "Asia-Pacific Executive Master of Business Administration in Malaysia",
+ "code_zh": "EMBA亞太馬國境外專班"
+ },
+ {
+ "code": "EMS",
+ "name_zh": "EMBA深圳境外專班",
+ "name_en": "MBA (ShenZhen)",
+ "code_zh": "EMBA深圳境外專班"
+ },
+ {
+ "code": "ENE",
+ "name_zh": "電子所",
+ "name_en": "Electronic Engineering",
+ "code_zh": "電子所"
+ },
+ {
+ "code": "ESS",
+ "name_zh": "工科系",
+ "name_en": "Engineering and System Science",
+ "code_zh": "工科系"
+ },
+ {
+ "code": "EST",
+ "name_zh": "環境博士學位學程",
+ "name_en": "International Ph.D. Program in Environmental Science and Technology(University System of Taiwan)",
+ "code_zh": "環境博士學程"
+ },
+ {
+ "code": "ESTU",
+ "name_zh": "環境博士學程與台聯大",
+ "name_en": " ",
+ "code_zh": "環境博士學程"
+ },
+ {
+ "code": "FL",
+ "name_zh": "外語系",
+ "name_en": "Foreign Languages and Literature",
+ "code_zh": "外語系"
+ },
+ {
+ "code": "FLU",
+ "name_zh": "外語系與交大合作課程",
+ "name_en": "Foreign Languages and Literature and NCTU",
+ "code_zh": "外語系"
+ },
+ {
+ "code": "FMMI",
+ "name_zh": "流機暨材料與智檢產碩",
+ "name_en": "Industrial Technology Graduate Program of Fluid Machinery and Advanced Materials with Intelligent In",
+ "code_zh": "流機暨材料與智檢產碩專班"
+ },
+ {
+ "code": "GE",
+ "name_zh": "通識中心",
+ "name_en": "General Education Center",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "GEC",
+ "name_zh": "通識核心",
+ "name_en": "General Education Core Courses",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "GEU",
+ "name_zh": "通識中心與交大合作課",
+ "name_en": "General Education and NCTU",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "GLLB",
+ "name_zh": "學士後法律學士學位學",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "GOM",
+ "name_zh": "全球營運管理碩士學程",
+ "name_en": "Dual Master Program for Global Operation Management",
+ "code_zh": "全球營運管理碩士學程"
+ },
+ {
+ "code": "GPTS",
+ "name_zh": "台研教專班",
+ "name_en": "Graduate Program of Taiwan Studies for In-service Teachers",
+ "code_zh": "台研教在職學位班"
+ },
+ {
+ "code": "HBA",
+ "name_zh": "健康經管碩士在職專班",
+ "name_en": "Master Program of Health Policy and Business Administration",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "HIS",
+ "name_zh": "歷史所",
+ "name_en": "History",
+ "code_zh": "歷史所"
+ },
+ {
+ "code": "HSS",
+ "name_zh": "人社院學士班",
+ "name_en": "Interdisciplinary Program of Humanities and Social Sciences",
+ "code_zh": "人社院學士班"
+ },
+ {
+ "code": "HSSU",
+ "name_zh": "人社學士班與交大合作",
+ "name_en": "Humanities and Social Science & NCTU",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "IACS",
+ "name_zh": "亞際文化碩士學程",
+ "name_en": "International Program in Inter-Asia Cultural Studies (University System of Taiwan)",
+ "code_zh": "亞際文化碩士學程"
+ },
+ {
+ "code": "IACU",
+ "name_zh": "亞際文化與台聯大合作",
+ "name_en": "International Program in Inter-Asia Cultural Studies (University System of Taiwan)",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "IBP",
+ "name_zh": "清華學院國際學士班",
+ "name_en": "Tsing Hua College International Bachelor Degree Program",
+ "code_zh": "國際學士班"
+ },
+ {
+ "code": "ICMS",
+ "name_zh": "計科所",
+ "name_en": "Institute of Computational and Modeling Science",
+ "code_zh": "計科所"
+ },
+ {
+ "code": "IEEM",
+ "name_zh": "工工系",
+ "name_en": "Industrial Engineering and Engineering Management",
+ "code_zh": "工工系"
+ },
+ {
+ "code": "IEM",
+ "name_zh": "工工在職專班",
+ "name_en": "Industrial Engineering and Engineering Management (Engineering Professional Master Program)",
+ "code_zh": "工工在職班"
+ },
+ {
+ "code": "IIS",
+ "name_zh": "資安所",
+ "name_en": "Institute of Information Security",
+ "code_zh": "資安所"
+ },
+ {
+ "code": "IMBA",
+ "name_zh": "IMBA碩士班",
+ "name_en": "International Master of Business Administration",
+ "code_zh": "IMBA碩士班"
+ },
+ {
+ "code": "IMCT",
+ "name_zh": "資通訊控制與熱流專班",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "IMII",
+ "name_zh": "AI製造與物聯網產碩班",
+ "name_en": "AI Intelligent Manufacturing and Industrial IoT Master Program of Industry",
+ "code_zh": "AI智造與物聯網產碩專班"
+ },
+ {
+ "code": "IMS",
+ "name_zh": "跨院國際碩士學位",
+ "name_en": "International Intercollegiate Master Program",
+ "code_zh": "跨院國際碩士"
+ },
+ {
+ "code": "IPE",
+ "name_zh": "工學院學士班",
+ "name_en": "Interdisciplinary Program of Engineering",
+ "code_zh": "工學院學士班"
+ },
+ {
+ "code": "IPHD",
+ "name_zh": "跨院國際博士學位",
+ "name_en": "International Intercollegiate Ph.D. Program",
+ "code_zh": "跨院國際博士"
+ },
+ {
+ "code": "IPMT",
+ "name_zh": "科管院學士班",
+ "name_en": "(112起) Interdisciplinary Program of Management and Technology",
+ "code_zh": "科管院學士班"
+ },
+ {
+ "code": "IPNS",
+ "name_zh": "原科院學士班",
+ "name_en": "Interdisciplinary Program of Nuclear Science",
+ "code_zh": "原科院學士班"
+ },
+ {
+ "code": "IPT",
+ "name_zh": "光電所",
+ "name_en": "Photonics Technologies",
+ "code_zh": "光電所"
+ },
+ {
+ "code": "IPTH",
+ "name_zh": "清華學院學士班",
+ "name_en": "Tsing Hua Interdisciplinary Program",
+ "code_zh": "清華學院學士班"
+ },
+ {
+ "code": "ISA",
+ "name_zh": "資應所",
+ "name_en": "Information Systems and Applications",
+ "code_zh": "資應所"
+ },
+ {
+ "code": "ISS",
+ "name_zh": "服科所",
+ "name_en": "Service Science",
+ "code_zh": "服科所"
+ },
+ {
+ "code": "JAC",
+ "name_zh": "藝術學院",
+ "name_en": "College of Arts",
+ "code_zh": "藝術學院學士班"
+ },
+ {
+ "code": "JAD",
+ "name_zh": "藝設系",
+ "name_en": "Department of Arts and Design",
+ "code_zh": "藝設系"
+ },
+ {
+ "code": "JADN",
+ "name_zh": "藝設系在職專班",
+ "name_en": " In-service Master Program of Arts Education for Teachers",
+ "code_zh": "藝設系"
+ },
+ {
+ "code": "JANT",
+ "name_zh": "科技藝術研究所",
+ "name_en": "Graduate Institute of Art and Technology",
+ "code_zh": "科藝所"
+ },
+ {
+ "code": "JITA",
+ "name_zh": "藝術學院學士班",
+ "name_en": "Interdisciplinary Program of Technology and Art",
+ "code_zh": "藝術學院學士班"
+ },
+ {
+ "code": "JMU",
+ "name_zh": "音樂系",
+ "name_en": "Department of Music",
+ "code_zh": "音樂系"
+ },
+ {
+ "code": "JMUN",
+ "name_zh": "音樂系在職專班",
+ "name_en": " In-service Master Program in Music",
+ "code_zh": "音樂系"
+ },
+ {
+ "code": "KCSN",
+ "name_zh": "學前特教在職專班",
+ "name_en": "Master Program in Early Childhood Special Education",
+ "code_zh": "學前特教在職學位學程"
+ },
+ {
+ "code": "KEC",
+ "name_zh": "環文系",
+ "name_en": "Department of Environmental and Cultural Resources",
+ "code_zh": "環文系在職專班"
+ },
+ {
+ "code": "KECN",
+ "name_zh": "環文系在職專班",
+ "name_en": " In-service Master Program of Community Development and Social Studies, Department of Environmental",
+ "code_zh": "環文系在職專班"
+ },
+ {
+ "code": "KEE",
+ "name_zh": "幼教系",
+ "name_en": "Department of Early Childhood Education",
+ "code_zh": "幼教系在職專班"
+ },
+ {
+ "code": "KEEN",
+ "name_zh": "幼教系在職專班",
+ "name_en": " Master Program in Early Childhood Education for In-service Practitioners",
+ "code_zh": "幼教系在職專班"
+ },
+ {
+ "code": "KEL",
+ "name_zh": "教科系",
+ "name_en": "Education and Learning Technology",
+ "code_zh": "教科系碩士在職專班"
+ },
+ {
+ "code": "KELN",
+ "name_zh": "教科系在職專班",
+ "name_en": " In-service Master Program of Curriculum and Instruction/Educational Administration",
+ "code_zh": "教科系"
+ },
+ {
+ "code": "KENI",
+ "name_zh": "英教系",
+ "name_en": "English Instruction",
+ "code_zh": "英教系"
+ },
+ {
+ "code": "KES",
+ "name_zh": "竹師教育學院博士班",
+ "name_en": "Ph.D. Program in Education Sciences",
+ "code_zh": "竹師教育學院博士班"
+ },
+ {
+ "code": "KHCT",
+ "name_zh": "竹師教育學院",
+ "name_en": "College of Education",
+ "code_zh": "竹師教育學院博士班"
+ },
+ {
+ "code": "KIPE",
+ "name_zh": "竹師教育學院學士班",
+ "name_en": "Interdisciplinary Program of Education",
+ "code_zh": "教育學院學士班"
+ },
+ {
+ "code": "KLST",
+ "name_zh": "學科所",
+ "name_en": "Institute of Learning Sciences and Technologies",
+ "code_zh": "學科所"
+ },
+ {
+ "code": "KMS",
+ "name_zh": "數理所",
+ "name_en": "Graduate Institute of Mathematics and Science Education",
+ "code_zh": "數理所在職專班"
+ },
+ {
+ "code": "KMSN",
+ "name_zh": "數理所在職專班",
+ "name_en": " Mathematics & Science Education Master Inservice Program",
+ "code_zh": "數理所在職專班"
+ },
+ {
+ "code": "KPC",
+ "name_zh": "心諮系",
+ "name_en": "Department of Educational Psychology and Counseling",
+ "code_zh": "心諮系在職專班"
+ },
+ {
+ "code": "KPCN",
+ "name_zh": "心諮系在職專班",
+ "name_en": "In-service Master Program of Educational Psychology and Counseling",
+ "code_zh": "心諮系在職專班"
+ },
+ {
+ "code": "KPE",
+ "name_zh": "體育系",
+ "name_en": "(已停用 Deactivate) Department of Physical Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "KSEN",
+ "name_zh": "STEAM碩士在職專班",
+ "name_en": "Master Program in Interdisciplinary STEAM Education",
+ "code_zh": "STEAM專班"
+ },
+ {
+ "code": "KSN",
+ "name_zh": "新加坡心諮碩專班",
+ "name_en": "Master ’s Program in Psychology and Counseling, Singapore",
+ "code_zh": "新加坡心諮碩班境外專班"
+ },
+ {
+ "code": "KSPE",
+ "name_zh": "特教系",
+ "name_en": "Special Education",
+ "code_zh": "特教系"
+ },
+ {
+ "code": "KSS",
+ "name_zh": "運科系",
+ "name_en": "Department of Kinesiology",
+ "code_zh": "運科系在職專班"
+ },
+ {
+ "code": "KSSN",
+ "name_zh": "運科系在職專班",
+ "name_en": "In-service Master Program of Kinesiology",
+ "code_zh": "運科系在職專班"
+ },
+ {
+ "code": "KTLT",
+ "name_zh": "臺語所",
+ "name_en": "Taiwan Languages and Language Teaching",
+ "code_zh": "臺語所"
+ },
+ {
+ "code": "KWEN",
+ "name_zh": "華德福碩士在職學程",
+ "name_en": "Master’s Program in Waldorf Education",
+ "code_zh": "華德福在職學位學程"
+ },
+ {
+ "code": "LANG",
+ "name_zh": "英語教育中心(110起)",
+ "name_en": "Center for English Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "LE",
+ "name_zh": "語文中心",
+ "name_en": "Center for Language Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "LING",
+ "name_zh": "語言所",
+ "name_en": "Linguistics",
+ "code_zh": "語言所"
+ },
+ {
+ "code": "LMIP",
+ "name_zh": "生醫學院學士班(112起",
+ "name_en": "Interdisciplinary Program of Life Sciences and Medicine",
+ "code_zh": "生醫學院學士班"
+ },
+ {
+ "code": "LS",
+ "name_zh": "生科系",
+ "name_en": "Life Science",
+ "code_zh": "生科系"
+ },
+ {
+ "code": "LSBI",
+ "name_zh": "生技產業博士學程",
+ "name_en": " ",
+ "code_zh": "生技博士學程"
+ },
+ {
+ "code": "LSBS",
+ "name_zh": "生資所",
+ "name_en": "Bioinformatics and Structural Biology",
+ "code_zh": "生資所"
+ },
+ {
+ "code": "LSBT",
+ "name_zh": "生技所",
+ "name_en": "Biotechnology",
+ "code_zh": "生技所"
+ },
+ {
+ "code": "LSC",
+ "name_zh": "生醫學院",
+ "name_en": "College of Life Science",
+ "code_zh": "生醫學院學士班"
+ },
+ {
+ "code": "LSIN",
+ "name_zh": "神經科學博士學程",
+ "name_en": "Ph.D. Program in Interdisciplinary Neuroscience(University System of Taiwan)",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "LSMC",
+ "name_zh": "分生所",
+ "name_en": "Molecular and Cellular Biology",
+ "code_zh": "分生所"
+ },
+ {
+ "code": "LSMM",
+ "name_zh": "分醫所",
+ "name_en": "Molecular Medicine",
+ "code_zh": "分醫所"
+ },
+ {
+ "code": "LSSN",
+ "name_zh": "系神所",
+ "name_en": "Systems Neuroscience",
+ "code_zh": "系神所"
+ },
+ {
+ "code": "LST",
+ "name_zh": "科法所",
+ "name_en": "Law for Science and Technology",
+ "code_zh": "科法所"
+ },
+ {
+ "code": "MATH",
+ "name_zh": "數學系",
+ "name_en": "Mathematics",
+ "code_zh": "數學系"
+ },
+ {
+ "code": "MATU",
+ "name_zh": "數學系與交大合作",
+ "name_en": "Mathematics & NCTU",
+ "code_zh": "數學系"
+ },
+ {
+ "code": "MBA",
+ "name_zh": "MBA專班",
+ "name_en": "Master of Business Administration",
+ "code_zh": "MBA專班"
+ },
+ {
+ "code": "MCLC",
+ "name_zh": "華語文碩士學位學程",
+ "name_en": "Master Program of Chinese Language and Culture",
+ "code_zh": "華語文碩士學位學程"
+ },
+ {
+ "code": "MFB",
+ "name_zh": "財金碩士專班",
+ "name_en": "Master Program of Finance and Banking",
+ "code_zh": "財金專班"
+ },
+ {
+ "code": "MI",
+ "name_zh": "國防教育課",
+ "name_en": "Military Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "MPM",
+ "name_zh": "公共政策與管理專班",
+ "name_en": "Master Program of Public Policy and Management",
+ "code_zh": "公共政策與管理碩士專班"
+ },
+ {
+ "code": "MS",
+ "name_zh": "材料系",
+ "name_en": "Materials Science and Engineering",
+ "code_zh": "材料系"
+ },
+ {
+ "code": "NEMS",
+ "name_zh": "奈微所",
+ "name_en": "NanoEngineering and MicroSystems",
+ "code_zh": "奈微所"
+ },
+ {
+ "code": "NES",
+ "name_zh": "核工所",
+ "name_en": "Nuclear Engineering and Science",
+ "code_zh": "核工所"
+ },
+ {
+ "code": "NUCL",
+ "name_zh": "原科院",
+ "name_en": "College of Nuclear Science",
+ "code_zh": "原科院學士班"
+ },
+ {
+ "code": "PE",
+ "name_zh": "體育室",
+ "name_en": "Physical Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "PE1",
+ "name_zh": "大一體育",
+ "name_en": "Physical Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "PE3",
+ "name_zh": "體育(校隊)",
+ "name_en": "Physical Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "PFMI",
+ "name_zh": "前瞻產博學程",
+ "name_en": "Ph. D. Program in Prospective Functional Materials Industry",
+ "code_zh": "前瞻產博學程"
+ },
+ {
+ "code": "PHIL",
+ "name_zh": "哲學所",
+ "name_en": "Philosophy",
+ "code_zh": "哲學所"
+ },
+ {
+ "code": "PHYS",
+ "name_zh": "物理系",
+ "name_en": "Physics",
+ "code_zh": "物理系"
+ },
+ {
+ "code": "PHYU",
+ "name_zh": "物理系與交大合作課程",
+ "name_en": "Physics and NCTU",
+ "code_zh": "物理系"
+ },
+ {
+ "code": "PME",
+ "name_zh": "動機系",
+ "name_en": "Power Mechanical Engineering",
+ "code_zh": "動機系"
+ },
+ {
+ "code": "PMED",
+ "name_zh": "精準醫療博士學位學程",
+ "name_en": "Presicion Medicine Ph.D. Program",
+ "code_zh": "精準醫療博士學程"
+ },
+ {
+ "code": "QF",
+ "name_zh": "計財系",
+ "name_en": "Quantitative Finance",
+ "code_zh": "計財系"
+ },
+ {
+ "code": "QTAM",
+ "name_zh": "量子科技博士學位學程",
+ "name_en": "Graduate Program of Quantum Technology and Advanced Materials",
+ "code_zh": "量子科技博士學位學程"
+ },
+ {
+ "code": "RADM",
+ "name_zh": "藥品醫材法規科學專班",
+ "name_en": "MS in Regulatory Affairs for Drugs & Medical Devices",
+ "code_zh": "藥品醫材法規科學專班"
+ },
+ {
+ "code": "RDDM",
+ "name_zh": "半導體元件及製程專班",
+ "name_en": "Industrial Technology R&D Master Program on Semiconductor Devices & Manufacturing Process",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "RDIC",
+ "name_zh": "積體電路設計專班",
+ "name_en": "Industrial Technology R&D Master Program on IC Design",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "RDPE",
+ "name_zh": "產業研發碩士電力電子",
+ "name_en": "Industrial Technology R&D Master Program on Power Electronics",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "S",
+ "name_zh": "理學院",
+ "name_en": "College of Science",
+ "code_zh": "理學院學士班"
+ },
+ {
+ "code": "SCI",
+ "name_zh": "理學院學士班",
+ "name_en": "Interdisciplinary Program of Sciences",
+ "code_zh": "理學院學士班"
+ },
+ {
+ "code": "SL",
+ "name_zh": "華文所",
+ "name_en": " ",
+ "code_zh": "華文所"
+ },
+ {
+ "code": "SLS",
+ "name_zh": "先進光源科技學位學程",
+ "name_en": "Doctor Program of Science and Technology of Synchrotron Light Source",
+ "code_zh": "先進光源學位學程"
+ },
+ {
+ "code": "SNHC",
+ "name_zh": "社群人智國際學程",
+ "name_en": "Social Networks and Human-Centered Computing",
+ "code_zh": "社群人智國際學程"
+ },
+ {
+ "code": "SOC",
+ "name_zh": "社會所",
+ "name_en": "Sociology",
+ "code_zh": "社會所"
+ },
+ {
+ "code": "STAT",
+ "name_zh": "統計所",
+ "name_en": "Statistics",
+ "code_zh": "統計所"
+ },
+ {
+ "code": "STAU",
+ "name_zh": "統計所與交大合作課程",
+ "name_en": "Statistics & NCTU",
+ "code_zh": "統計所"
+ },
+ {
+ "code": "TE",
+ "name_zh": "師培中心(中等教程)",
+ "name_en": "Teacher Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "TEE",
+ "name_zh": "師培中心(國小教程)",
+ "name_en": "Teacher Education",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "TEG",
+ "name_zh": "師培中心(一般課程)",
+ "name_en": "Teacher Education (General Courses)",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "THC",
+ "name_zh": "清華學院",
+ "name_en": "Tsing Hua College",
+ "code_zh": "清華學院學士班"
+ },
+ {
+ "code": "THSM",
+ "name_zh": "學士後醫學系",
+ "name_en": " ",
+ "code_zh": "醫學系"
+ },
+ {
+ "code": "TIGP",
+ "name_zh": "國際研究生學程",
+ "name_en": "Taiwan International Graduate Program",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "TL",
+ "name_zh": "台文所",
+ "name_en": "Taiwan Literature",
+ "code_zh": "台文所"
+ },
+ {
+ "code": "TM",
+ "name_zh": "科管所",
+ "name_en": "Technology Management",
+ "code_zh": "科管所"
+ },
+ {
+ "code": "TSE",
+ "name_zh": "台北政經學院",
+ "name_en": "Taipei School of Economics and Political Science",
+ "code_zh": "台北政經學院政治經濟碩士"
+ },
+ {
+ "code": "UPPP",
+ "name_zh": "光電博士學程",
+ "name_en": "Ph.D. Program in Photonics (University System of Taiwan)",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "VA",
+ "name_zh": "合校過渡單位",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "VGE",
+ "name_zh": "南大校區原系統通識課",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "VM",
+ "name_zh": "加退選後開設之微學分",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "W",
+ "name_zh": "W課號課程",
+ "name_en": "Interschool Courses",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "WH",
+ "name_zh": "跨系統,台聯大&互惠課",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "WW",
+ "name_zh": "陽明交大課程",
+ "name_en": "NCTU COURSE",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "WZ",
+ "name_zh": "外校課程",
+ "name_en": "",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "X",
+ "name_zh": "X抵免課程",
+ "name_en": " ",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "XA",
+ "name_zh": "抵免課程(大)",
+ "name_en": "",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "XZ",
+ "name_zh": "抵免課程(研)",
+ "name_en": "",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "YZ",
+ "name_zh": "課務組專用",
+ "name_en": "",
+ "code_zh": "N/A"
+ },
+ {
+ "code": "ZY",
+ "name_zh": "服務學習",
+ "name_en": "Service Learning",
+ "code_zh": "N/A"
+ }
+]
\ No newline at end of file
diff --git a/src/helpers/courses.ts b/src/helpers/courses.ts
index 676872e4..00c8055f 100644
--- a/src/helpers/courses.ts
+++ b/src/helpers/courses.ts
@@ -1,5 +1,8 @@
-import { MinimalCourse, RawCourseID } from "@/types/courses";
-import { createTimetableFromCourses } from "./timetable";
+import { Language, MinimalCourse, RawCourseID } from '@/types/courses';
+import { createTimetableFromCourses } from './timetable';
+import { departments } from '@/const/departments';
+import { classCode } from '@/const/class_code';
+
export const getGECType = (ge_type: string) => {
//核心通識Core GE courses 1, 核心通識Core GE courses 2 <- return this number
if (ge_type.includes("核心通識Core GE courses")) {
@@ -56,59 +59,81 @@ export const getScoreType = (score: string) => {
};
// Define mappings for degree types and class letters
-const degreeTypes: { [x: string]: string } = {
- B: "",
- M: "碩士班",
- D: "博士班",
- P: "專班",
+const degreeTypes: { [key: string]: any } = {
+ 'zh': { 'B': '', 'M': '碩士班', 'D': '博士班', 'P': '專班' },
+ 'en': { 'B': '', 'M': 'Master', 'D': 'Doctoral', 'P': 'Special' }
+};
+
+const classLetters : { [key: string]: any } = {
+ 'zh': { 'A': '清班', 'B': '華班', 'C': '梅班', 'D': '班' },
+ 'en': { 'A': 'Qing', 'B': 'Hua', 'C': 'Mei', 'D': '' }
};
-const classLetters: { [x: string]: string } = {
- A: "清班",
- B: "華班",
- C: "梅班",
- D: "班",
-}; // Assuming 'D' stands for a general class
+
export const checkValidClassCode = (class_code: string, semester: string) => {
- // Parse the input string
- const match = class_code.toUpperCase().match(/(^[^\d]+)(\d+)([BMD])([A-D]?)/);
- if (!match) {
- return class_code;
- }
+ // Parse the input string
+ const match = class_code.toUpperCase().match(/(^[^\d]+)(\d+)([BMD])([A-D]?)/);
+ if (!match) {
+ return class_code;
+ }
- const sem = parseInt(semester.slice(0, 3));
+ const sem = parseInt(semester.slice(0, 3));
- // Extract components
- const [, deptName, year, degreeType, classLetter] = match;
+ // Extract components
+ const [, deptName, year, degreeType, classLetter] = match;
- //if degreetype = B and year - sem > 4, return false
- if (sem - parseInt(year) > 4) {
- return false;
- }
- return true;
-};
+ //if degreetype = B and year - sem > 4, return false
+ if((sem - parseInt(year)) > 4){
+ return false;
+ }
+ return true;
+}
+
+export const getFormattedClassCode = (class_code: string, semester: string, lang: string) =>{
+ // Parse the input string
+ const match = class_code.toUpperCase().match(/(^[^\d]+)(\d+)([BMDP])([A-D]?)/);
+ if (!match) {
+ return class_code;
+ }
+
+ const sem = parseInt(semester.slice(0, 3));
-export const getFormattedClassCode = (class_code: string, semester: string) => {
- // Parse the input string
- const match = class_code.toUpperCase().match(/(^[^\d]+)(\d+)([BMD])([A-D]?)/);
- if (!match) {
- return class_code;
- }
+ // Extract components
+ const [, deptName, year, degreeType, classLetter] = match;
- const sem = parseInt(semester.slice(0, 3));
+ // Translate components
+ const yearNumber = sem - parseInt(year) + 1;
+ const readableYear = lang === 'zh' ? `${yearNumber}年級` : ` Y${yearNumber} `;
- // Extract components
- const [, deptName, year, degreeType, classLetter] = match;
- // Translate components
- const readableYear = sem - parseInt(year) + 1 + "年級";
- const readableDegreeType = degreeTypes[degreeType] || "";
- const readableClassLetter = classLetters[classLetter] || "";
+ const readableDegreeType = degreeTypes[lang][degreeType] || '';
+ const readableClassLetter = classLetters[lang][classLetter] || '';
- // exception for EECS-GS
- if (deptName == "電資院學士班" && degreeType == "B" && classLetter == "A") {
- return `電資院學士班${readableYear}國際學程`;
- }
+ const department = classCode.find(dept => dept.code_zh === deptName);
+
+ let deptCode;
- // Construct the output
- return `${deptName}${readableYear}${readableDegreeType}${readableClassLetter}`;
-};
+ if (department?.code_zh == 'NA') {
+ deptCode = deptName;
+ } else {
+ // Select the department name based on the language
+ deptCode = lang === 'zh' ? department?.code_zh : department?.code;
+ }
+
+ // exception for EECS-GS
+ if (deptName == '電資院學士班' && degreeType == 'B' && classLetter == 'A'){
+ return lang === 'zh' ? `電資院學士班${readableYear}國際學程` : `EECS-GS ${readableYear}`;
+ }
+
+ // Translate components
+ const readableYear = sem - parseInt(year) + 1 + "年級";
+ const readableDegreeType = degreeTypes[degreeType] || "";
+ const readableClassLetter = classLetters[classLetter] || "";
+
+ // exception for EECS-GS
+ if (deptName == "電資院學士班" && degreeType == "B" && classLetter == "A") {
+ return `電資院學士班${readableYear}國際學程`;
+ }
+
+ // Construct the output
+ return `${deptName}${readableYear}${readableDegreeType}${readableClassLetter}`;
+};
\ No newline at end of file