@@ -470,32 +470,34 @@ private static DynamoModel StartDynamoWithDefaultConfig(bool CLImode,
470470 return model ;
471471 }
472472
473+ /// <summary>
474+ /// Sets the application locale from parsed command-line arguments.
475+ /// </summary>
476+ /// <param name="cmdLineArgs">Parsed command-line arguments.</param>
477+ /// <returns>A locale environment string in the format <c>LANGUAGE=xx_YY</c> for the resolved locale.</returns>
478+ [ Obsolete ( "The API has been deprecated and will be removed in a future release of Dynamo. Make a direct call to DynamoModel.SetUICulture instead." ) ]
473479 public static string SetLocale ( CommandLineArguments cmdLineArgs )
474480 {
475- var supportedLocale = new HashSet < string > ( Configuration . Configurations . SupportedLocaleDic . Values ) ;
476- string libgLocale = string . Empty ;
481+ var supportedLocale = new HashSet < string > ( Configurations . SupportedLocaleDic . Values ) ;
482+ string locale = string . Empty ;
477483
478484 if ( ! string . IsNullOrEmpty ( cmdLineArgs . Locale ) )
479485 {
480- // Change the application locale, if a locale information is supplied.
481486 DynamoModel . SetUICulture ( cmdLineArgs . Locale ) ;
482- libgLocale = cmdLineArgs . Locale ;
487+ locale = cmdLineArgs . Locale ;
483488 }
484489 else
485490 {
486- // In case no language is specified, libG's locale should be that of the OS.
487- // There is no need to set Dynamo's locale in this case.
488- libgLocale = CultureInfo . InstalledUICulture . ToString ( ) ;
491+ locale = CultureInfo . InstalledUICulture . ToString ( ) ;
489492 }
490493
491494 // If locale is not supported by Dynamo, default to en-US.
492- if ( ! supportedLocale . Any ( s => s . Equals ( libgLocale , StringComparison . InvariantCultureIgnoreCase ) ) )
495+ if ( ! supportedLocale . Any ( s => s . Equals ( locale , StringComparison . InvariantCultureIgnoreCase ) ) )
493496 {
494- libgLocale = "en-US" ;
497+ locale = "en-US" ;
495498 }
496- // Change the locale that LibG depends on.
497499 StringBuilder sb = new StringBuilder ( "LANGUAGE=" ) ;
498- sb . Append ( libgLocale . Replace ( "-" , "_" ) ) ;
500+ sb . Append ( locale . Replace ( "-" , "_" ) ) ;
499501 return sb . ToString ( ) ;
500502 }
501503
0 commit comments