@@ -63,10 +63,29 @@ def get_mui_locales_from_package() -> Set[str]:
6363 the mui-phone locale.ts structure and inferring from MUI's locale module.
6464
6565 Since MUI locales are accessed dynamically via "@mui/material/locale",
66- we need to check what locales are available in the package .
66+ we try to extract them from the phone-hooks locale file or use a fallback list .
6767 """
68- # MUI Material has built-in locales that can be imported
68+ project_root = Path (__file__ ).parent .parent .parent
69+ phone_locale_file = project_root / "development" / "src" / "phone-hooks" / "locale.ts"
70+
71+ # Try to extract from phone-hooks locale.ts if available
72+ if phone_locale_file .exists ():
73+ try :
74+ with open (phone_locale_file , 'r' , encoding = 'utf-8' ) as f :
75+ content = f .read ()
76+
77+ # Extract exports from phone-hooks locale (same format as react-phone-hooks)
78+ locale_pattern = r'^export const (\w+) = \{'
79+ locales = set (re .findall (locale_pattern , content , re .MULTILINE ))
80+
81+ if locales :
82+ return locales
83+ except Exception as e :
84+ print (f"Warning: Could not parse phone-hooks locale.ts: { e } " )
85+
86+ # Fallback: MUI Material has built-in locales that can be imported
6987 # Common MUI locales based on their documentation
88+ # This list should be kept in sync with MUI Material's supported locales
7089 mui_locales = {
7190 'arEG' , 'arSA' , 'arSD' , 'azAZ' , 'bgBG' , 'bnBD' , 'caES' , 'csCZ' ,
7291 'daDK' , 'deDE' , 'elGR' , 'enUS' , 'esES' , 'etEE' , 'faIR' , 'fiFI' ,
0 commit comments