feat: Implement core e-learning features including course discovery, classroom components, user profile management, and internationalization for English and Thai.
This commit is contained in:
parent
e7a2ac8b5a
commit
7ead98375e
11 changed files with 107 additions and 43 deletions
|
|
@ -644,14 +644,19 @@ export const useCourse = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const { locale } = useI18n()
|
||||
|
||||
/**
|
||||
* Helper: แปลงข้อมูล 2 ภาษาเป็นข้อความตาม locale ปัจจุบัน หรือค่าที่มีอยู่
|
||||
*/
|
||||
const getLocalizedText = (text: string | { th: string; en: string } | undefined | null) => {
|
||||
if (!text) return ''
|
||||
if (typeof text === 'string') return text
|
||||
|
||||
// Return based on current locale, fallback to th then en
|
||||
const currentLocale = locale.value as 'th' | 'en'
|
||||
// @ts-ignore
|
||||
return text.th || text.en || ''
|
||||
return text[currentLocale] || text.th || text.en || ''
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue