﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;

namespace DeVi.Converters
{
	internal class CultureToXmlLanguage : IValueConverter
	{
		public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
		{
			CultureInfo v = value as CultureInfo;
			return v == null ? DependencyProperty.UnsetValue : XmlLanguage.GetLanguage( v.IetfLanguageTag );
		}

		public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
		{
			throw new NotSupportedException();
		}
	}
}