Inheritance: Net.Astropenguin.Loaders.StringResources
Esempio n. 1
0
        private static string GetPluralTimeUnits(int units, string[] resources)
        {
            int modTen     = units % 10;
            int modHundred = units % 100;

            ControlResources C = new ControlResources();
            IFormatProvider  i = C.Culture.DateTimeFormat;

            if (units <= 1)
            {
                throw new ArgumentException("Invalid number of Time units");
            }
            else if (units >= 2 && units <= 4)
            {
                return(string.Format(i, resources[0], units.ToString(i)));
            }
            else if (modTen == 1 && modHundred != 11)
            {
                return(string.Format(i, resources[1], units.ToString(i)));
            }
            else if ((modTen >= 2 && modTen <= 4) && !(modHundred >= 12 && modHundred <= 14))
            {
                return(string.Format(i, resources[2], units.ToString(i)));
            }
            else
            {
                return(string.Format(i, resources[3], units.ToString(i)));
            }
        }
Esempio n. 2
0
        private static string GetPluralTimeUnits( int units, string[] resources )
        {
            int modTen = units % 10;
            int modHundred = units % 100;

            ControlResources C = new ControlResources();
            IFormatProvider i = C.Culture.DateTimeFormat;
            if ( units <= 1 )
            {
                throw new ArgumentException( "Invalid number of Time units" );
            }
            else if ( units >= 2 && units <= 4 )
            {
                return string.Format( i, resources[ 0 ], units.ToString( i ) );
            }
            else if ( modTen == 1 && modHundred != 11 )
            {
                return string.Format( i, resources[ 1 ], units.ToString( i ) );
            }
            else if ( ( modTen >= 2 && modTen <= 4 ) && !( modHundred >= 12 && modHundred <= 14 ) )
            {
                return string.Format( i, resources[ 2 ], units.ToString( i ) );
            }
            else
            {
                return string.Format( i, resources[ 3 ], units.ToString( i ) );
            }
        }
Esempio n. 3
0
        private static string GetPluralMonth(int month)
        {
            ControlResources C = new ControlResources();
            IFormatProvider  i = C.Culture.DateTimeFormat;

            if (month >= 2 && month <= 4)
            {
                return(string.Format(i, C.Str("XMonthsAgo_2To4"), month.ToString(i)));
            }
            else if (month >= 5 && month <= 12)
            {
                return(string.Format(i, C.Str("XMonthsAgo_5To12"), month.ToString(i)));
            }
            else
            {
                throw new ArgumentException("Invalid number of Months");
            }
        }
Esempio n. 4
0
        private static string GetPluralMonth( int month )
        {
            ControlResources C = new ControlResources();
            IFormatProvider i = C.Culture.DateTimeFormat;

            if ( month >= 2 && month <= 4 )
            {
                return string.Format( i, C.Str( "XMonthsAgo_2To4" ), month.ToString( i ) );
            }
            else if ( month >= 5 && month <= 12 )
            {
                return string.Format( i, C.Str( "XMonthsAgo_5To12" ), month.ToString( i ) );
            }
            else
            {
                throw new ArgumentException( "Invalid number of Months" );
            }
        }
Esempio n. 5
0
        private static string GetOnDayOfWeek(DayOfWeek dow)
        {
            string result;

            ControlResources ControlResources = new ControlResources();

            switch (dow)
            {
            case DayOfWeek.Monday:
                result = ControlResources.Str("on Monday");
                break;

            case DayOfWeek.Tuesday:
                result = ControlResources.Str("on Tuesday");
                break;

            case DayOfWeek.Wednesday:
                result = ControlResources.Str("on Wednesday");
                break;

            case DayOfWeek.Thursday:
                result = ControlResources.Str("on Thursday");
                break;

            case DayOfWeek.Friday:
                result = ControlResources.Str("on Friday");
                break;

            case DayOfWeek.Saturday:
                result = ControlResources.Str("on Saturday");
                break;

            case DayOfWeek.Sunday:
                result = ControlResources.Str("on Sunday");
                break;

            default:
                result = ControlResources.Str("on Sunday");
                break;
            }

            return(result);
        }
Esempio n. 6
0
        private static string GetOnDayOfWeek( DayOfWeek dow )
        {
            string result;

            ControlResources ControlResources = new ControlResources();
            switch ( dow )
            {
                case DayOfWeek.Monday:
                    result = ControlResources.Str( "on Monday" );
                    break;
                case DayOfWeek.Tuesday:
                    result = ControlResources.Str( "on Tuesday" );
                    break;
                case DayOfWeek.Wednesday:
                    result = ControlResources.Str( "on Wednesday" );
                    break;
                case DayOfWeek.Thursday:
                    result = ControlResources.Str( "on Thursday" );
                    break;
                case DayOfWeek.Friday:
                    result = ControlResources.Str( "on Friday" );
                    break;
                case DayOfWeek.Saturday:
                    result = ControlResources.Str( "on Saturday" );
                    break;
                case DayOfWeek.Sunday:
                    result = ControlResources.Str( "on Sunday" );
                    break;
                default:
                    result = ControlResources.Str( "on Sunday" );
                    break;
            }

            return result;
        }