/// <summary> /// Converts a dictionary of translated strings and the currently selected language, into a specific translated string. /// </summary> /// <param name="value">An array containing a SortedDictionary of translated strings, and a string to use as a key into it</param> /// <param name="targetType">The parameter is not used.</param> /// <param name="parameter">The parameter is not used.</param> /// <param name="language">The parameter is not used.</param> /// <returns>A translated string value</returns> public object Convert(object[] value, Type targetType, object parameter, CultureInfo language) { SortedDictionary <string, GP070CTC1.TranslatedString> d = value[0] as SortedDictionary <string, GP070CTC1.TranslatedString>; if (d != null) { string lang = value[1] as string; if (lang != null) { if (lang != "All") { GP070CTC1.TranslatedString translatedString = d[lang]; if (value.Length <= 2) { return(translatedString.Value); } string contextName = value[2] as string; return(translatedString.Value + " (" + contextName + ")"); } } } return(null); }
/// <summary> /// Converts for converting a dictionary of translated strings and the current selected language, into a visibility flag /// </summary> /// <param name="value">An array containing a SortedDictionary of translated strings, and a string to use as a key into it</param> /// <param name="targetType">The parameter is not used.</param> /// <param name="parameter">The parameter is not used.</param> /// <param name="language">The parameter is not used.</param> /// <returns>A visibility value</returns> public object Convert(object[] value, Type targetType, object parameter, CultureInfo language) { SortedDictionary <string, GP070CTC1.TranslatedString> d = value[0] as SortedDictionary <string, GP070CTC1.TranslatedString>; if (d != null) { string lang = value[1] as string; if (lang != null) { if (lang != "All") { GP070CTC1.TranslatedString translatedString = d[lang]; return((translatedString.ExpandedStrings.Count != 1) ? Visibility.Visible : Visibility.Collapsed); } } } return(null); }