Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:rhinocommonsamples:determinecurrentlanguage [2015/09/14] (current)
Line 1: Line 1:
 +===== Sample: Determine Rhino'​s Language Setting =====
 +
 +===== C# =====
 +<code c#>
 +public class DetermineCurrentLanguageCommand : Command
 +{
 +  public override string EnglishName { get { return "​csCurrentLanguage";​ } }
 +
 +  protected override Result RunCommand(RhinoDoc doc, RunMode mode)
 +  {
 +    var language_id = Rhino.ApplicationSettings.AppearanceSettings.LanguageIdentifier;​
 +    var culture = new System.Globalization.CultureInfo(language_id);​
 +    RhinoApp.WriteLine("​The current language is {0}", culture.EnglishName);​
 +    return Result.Success;​
 +  }
 +}
 +</​code>​
 +===== VB.NET =====
 +<code vb>
 +Public Class DetermineCurrentLanguageCommand
 +  Inherits Command
 +  Public Overrides ReadOnly Property EnglishName() As String
 +    Get
 +      Return "​vbCurrentLanguage"​
 +    End Get
 +  End Property
 +
 +  Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
 +    Dim language_id = Rhino.ApplicationSettings.AppearanceSettings.LanguageIdentifier
 +    Dim culture = New System.Globalization.CultureInfo(language_id)
 +    RhinoApp.WriteLine("​The current language is {0}", culture.EnglishName)
 +    Return Result.Success
 +  End Function
 +End Class
 +d Namespace
 +</​code>​
 +===== Python =====
 +<code python>
 +import rhinoscriptsyntax as rs
 +import System
 +
 +locale_id = rs.LocaleID()
 +culture = System.Globalization.CultureInfo(locale_id)
 +print culture.EnglishName
 +</​code>​
 +
 +{{tag>​Developer rhinocommon}}
  
developer/rhinocommonsamples/determinecurrentlanguage.txt ยท Last modified: 2015/09/14 (external edit)