Rhino provides support for multiple languages. And, Rhino's language setting is independent of the operating system's language setting. Thus, as a plug-in developer, knowing Rhino's current language setting is important if you plan on supporting multiple languages.
Rhino stores it's current Locale ID (LCID) in a CRhinoAppAppearanceSettings object that is held within Rhino applications settings object, or CRhinoAppSettings.
The following is an example of how to determine Rhino's current language setting.
ON_wString wstr;
CRhinoAppSettings settings = ::RhinoApp().AppSettings();
CRhinoAppAppearanceSettings appearance = settings.AppearanceSettings();
switch( appearance.m_language_identifier )
{
case 1028: // zh-tw
wstr = L"Chinese - Taiwan";
break;
case 1029: // cs
wstr = L"Czech";
break;
case 1031: // de-de
wstr = L"German - Germany";
break;
case 1033: // en-us
wstr = L"English - United States";
break;
case 1034: // es-es
wstr = L"Spanish - Spain";
break;
case 1036: // fr-fr
wstr = L"French - France";
break;
case 1040: // it-it
wstr = L"Italian - Italy";
break;
case 1041: // ja
wstr = L"Japanese";
break;
case 1042: // ko
wstr = L"Korean";
break;
case 1045: // pl
wstr = L"Polish";
break;
case 2052: // zh-cn
wstr = L"Chinese - China";
break;
default:
wstr = L"unknown";
break;
}
::RhinoApp().Print( L"The current language is \"%s\"" , wstr );
Public Overrides Function RunCommand(ByVal context As IRhinoCommandContext) _
As IRhinoCommand.result
Dim settings As MRhinoAppSettings = RhUtil.RhinoApp.AppSettings
Dim appearance As IRhinoAppAppearanceSettings = settings.AppearanceSettings()
Dim id As Integer = CType(appearance.m_language_identifier, Integer)
Dim culture As New System.Globalization.CultureInfo(id)
RhUtil.RhinoApp.Print("The current language is " + culture.EnglishName + vbCrLf)
Return IRhinoCommand.result.success
End Function
public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
{
MRhinoAppSettings settings = RhUtil.RhinoApp().AppSettings();
IRhinoAppAppearanceSettings appearance = settings.AppearanceSettings();
int id = (int)appearance.m_language_identifier;
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(id);
RhUtil.RhinoApp().Print( "The current language is " + culture.EnglishName + "\n" );
return IRhinoCommand.result.success;
}