@@ -73,12 +73,25 @@ def cmd_init(args):
7373 from .entity_detector import scan_for_detection , detect_entities , confirm_entities
7474 from .room_detector_local import detect_rooms_local
7575
76+ cfg = MempalaceConfig ()
77+
78+ # Resolve entity-detection languages: --lang overrides config.
79+ lang_arg = getattr (args , "lang" , None )
80+ if lang_arg :
81+ languages = [s .strip () for s in lang_arg .split ("," ) if s .strip ()] or ["en" ]
82+ cfg .set_entity_languages (languages )
83+ else :
84+ languages = cfg .entity_languages
85+ languages_tuple = tuple (languages )
86+
7687 # Pass 1: auto-detect people and projects from file content
7788 print (f"\n Scanning for entities in: { args .dir } " )
89+ if languages_tuple != ("en" ,):
90+ print (f" Languages: { ', ' .join (languages_tuple )} " )
7891 files = scan_for_detection (args .dir )
7992 if files :
8093 print (f" Reading { len (files )} files..." )
81- detected = detect_entities (files )
94+ detected = detect_entities (files , languages = languages_tuple )
8295 total = len (detected ["people" ]) + len (detected ["projects" ]) + len (detected ["uncertain" ])
8396 if total > 0 :
8497 confirmed = confirm_entities (detected , yes = getattr (args , "yes" , False ))
@@ -93,7 +106,7 @@ def cmd_init(args):
93106
94107 # Pass 2: detect rooms from folder structure
95108 detect_rooms_local (project_dir = args .dir , yes = getattr (args , "yes" , False ))
96- MempalaceConfig () .init ()
109+ cfg .init ()
97110
98111 # Pass 3: protect git repos from accidentally committing per-project files
99112 _ensure_mempalace_files_gitignored (args .dir )
@@ -478,6 +491,16 @@ def main():
478491 action = "store_true" ,
479492 help = "Auto-accept all detected entities (non-interactive)" ,
480493 )
494+ p_init .add_argument (
495+ "--lang" ,
496+ default = None ,
497+ help = (
498+ "Comma-separated language codes for entity detection "
499+ "(e.g. 'en' or 'en,pt-br'). Defaults to value from config "
500+ "(MEMPALACE_ENTITY_LANGUAGES env var or config.json), or 'en'. "
501+ "When given, the value is also persisted to config.json."
502+ ),
503+ )
481504
482505 # mine
483506 p_mine = sub .add_parser ("mine" , help = "Mine files into the palace" )
0 commit comments