File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,32 @@ public static void ReloadLocales(IMod pMod)
3737 string locale_path = localizable_mod . GetLocaleFilesDirectory ( pMod . GetDeclaration ( ) ) ;
3838 if ( ! Directory . Exists ( locale_path ) ) return ;
3939
40- var files = Directory . GetFiles ( locale_path ) ;
40+ var files = Directory . GetFiles ( locale_path , "*" , SearchOption . AllDirectories ) ;
41+ char csv_separator = ',' ;
42+ if ( pMod is ICsvSepCustomized sep_customized )
43+ csv_separator = sep_customized . GetCsvSeparator ( ) ;
44+
4145 foreach ( var locale_file in files )
4246 {
4347 LogService . LogInfo (
4448 $ "Reload { locale_file } as { Path . GetFileNameWithoutExtension ( locale_file ) } ") ;
45- LM . LoadLocale ( Path . GetFileNameWithoutExtension ( locale_file ) , locale_file ) ;
49+ try
50+ {
51+ if ( locale_file . EndsWith ( ".json" , StringComparison . OrdinalIgnoreCase ) )
52+ {
53+ LM . LoadLocale ( Path . GetFileNameWithoutExtension ( locale_file ) , locale_file ) ;
54+ }
55+ else if ( locale_file . EndsWith ( ".csv" , StringComparison . OrdinalIgnoreCase ) )
56+ {
57+ LM . LoadLocales ( locale_file , csv_separator ) ;
58+ }
59+ }
60+ catch ( FormatException e )
61+ {
62+ LogService . LogWarning ( e . Message ) ;
63+ }
4664 }
4765
4866 LM . ApplyLocale ( ) ;
4967 }
50- }
68+ }
You can’t perform that action at this time.
0 commit comments