public void Intercept(IInvocation invocation) { var cultureDirective = new CultureDirective { Culture = Thread.CurrentThread.CurrentCulture.Name, UICulture = Thread.CurrentThread.CurrentUICulture.Name }; WriteMessageHeaders(cultureDirective, OperationContext.Current); invocation.Proceed(); }
private static bool ParseCultureDirective(CultureDirective directive, out CultureInfo culture, out CultureInfo uiCulture) { if (directive == null) { culture = null; uiCulture = null; return false; } culture = SafeGetCulture(directive.Culture); uiCulture = SafeGetCulture(directive.UICulture); return true; }
private static bool ParseCultureDirective(CultureDirective directive, out CultureInfo culture, out CultureInfo uiCulture) { if (directive == null) { culture = null; uiCulture = null; return(false); } culture = SafeGetCulture(directive.Culture); uiCulture = SafeGetCulture(directive.UICulture); return(true); }
/// <summary> /// Writes the message header the operation context. /// </summary> /// <param name="directive"></param> /// <param name="operationContext"></param> protected internal static void WriteMessageHeaders(CultureDirective directive, OperationContext operationContext) { var header = MessageHeader.CreateHeader(HeaderName, HeaderNamespace, directive); operationContext.OutgoingMessageHeaders.Add(header); }