using System;
using System.Globalization;

namespace CommonHelpers {

//**************************************************************************************************
public static partial class HLocal {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentNullException" />
public static string TEXT( string englishText, string russianText )
{
   HArgChecking.VerifyNotNulls( englishText, russianText );
   string cultureNeutralName = HCultureInfo.ToNeutral( CultureInfo.CurrentUICulture ).Name;
   switch ( cultureNeutralName )
   {
   case "en": return englishText;
   case "ru": return russianText;
   }
   string bigLanguageName = Environment.GetEnvironmentVariable( "NLS_BigLanguageName" );
   if ( bigLanguageName != null )
   {
      if ( HString.Equals( bigLanguageName, "English", true ) )
         return englishText;
      else
      if ( HString.Equals( bigLanguageName, "Russian", true ) )
         return russianText;
      goto DEFAULT;
   }
   switch ( TakeAccountBigCultureUsage( cultureNeutralName ) )
   {
   case "en": return englishText;
   case "ru": return russianText;
   }
DEFAULT:
   return englishText;
}

//==================================================================================================

static string TakeAccountBigCultureUsage([HOptional] string cultureNeutralName)
{
   switch ( cultureNeutralName )
   {
   case null: return null;
//*
   case "hy": return "ru"; // Armenian
   case "az": return "ru"; // Azeri
   case "be": return "ru"; // Belarusian
   case "kk": return "ru"; // Kazakh
   case "ky": return "ru"; // Kyrgyz
   case "mn": return "ru"; // Mongolian
// case "uk": return "ru"; // Ukrainian
   case "uz": return "ru"; // Uzbek
//*/
   default: return cultureNeutralName;
   }
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HLocal
//**************************************************************************************************

} // CommonHelpers
