mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-19 09:01:32 +01:00
Display supported cultures in their native names.
This commit is contained in:
1 parent
b02da10dbc
commit
2fd8d86aa1
6 files changed
+59
-12
No files matched your search
@@ -124,6 +124,7 @@
|
||||
<Compile Include="ConversionPreset\ConversionPreset.cs" />
|
||||
<Compile Include="ValueConverters\BitrateToString.cs" />
|
||||
<Compile Include="ValueConverters\FileNameConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\CultureInfoToStringConverter.cs" />
|
||||
<Compile Include="ValueConverters\Generic\BoolToVisibility.cs" />
|
||||
<Compile Include="ValueConverters\ConversionSettingsToString.cs" />
|
||||
<Compile Include="ValueConverters\Generic\BoolInverterConverter.cs" />
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace FileConverter
|
||||
|
||||
public static class Helpers
|
||||
{
|
||||
public static IEnumerable<CultureInfo> GetSupportedCulture()
|
||||
public static IEnumerable<CultureInfo> GetSupportedCultures()
|
||||
{
|
||||
//Get all culture
|
||||
CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace FileConverter
|
||||
{
|
||||
CultureInfo bestCandidate = null;
|
||||
CultureInfo currentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
|
||||
foreach (CultureInfo culture in Helpers.GetSupportedCulture())
|
||||
foreach (CultureInfo culture in Helpers.GetSupportedCultures())
|
||||
{
|
||||
if (culture.Equals(currentUICulture))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// <copyright file="BoolInverterConverter.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.ValueConverters.Generic
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class CultureInfoToStringConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
CultureInfo cultureInfo = value as CultureInfo;
|
||||
if (cultureInfo == null)
|
||||
{
|
||||
throw new System.ArgumentException("The object must be a culture info instance.");
|
||||
}
|
||||
|
||||
string nativeName = cultureInfo.NativeName;
|
||||
if (string.IsNullOrEmpty(nativeName))
|
||||
{
|
||||
return cultureInfo.Name;
|
||||
}
|
||||
|
||||
if (nativeName.Length == 1)
|
||||
{
|
||||
return nativeName.ToUpper(cultureInfo);
|
||||
}
|
||||
|
||||
return nativeName.Substring(0, 1).ToUpper(cultureInfo) + nativeName.Substring(1, nativeName.Length - 1); ;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<generic:CultureInfoToStringConverter x:Key="CultureInfoToString"/>
|
||||
<generic:DoubleToTimeString x:Key="DoubleToTimeString"/>
|
||||
<valueConverters:FileNameConverter x:Key="FileNameConverter"/>
|
||||
<generic:CollectionContainsElementToBool x:Key="CollectionContainsElementToBool"/>
|
||||
@@ -757,7 +758,14 @@
|
||||
<StackPanel Margin="5,10,5,5">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label Content="Language :"/>
|
||||
<ComboBox Name="LanguageComboBox" SelectedValue="{Binding ApplicationSettings.ApplicationLanguage, ElementName=window, Mode=TwoWay}"/>
|
||||
<ComboBox ItemsSource="{Binding SupportedCultures, ElementName=window, Mode=OneWay}"
|
||||
SelectedValue="{Binding ApplicationSettings.ApplicationLanguage, ElementName=window, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource CultureInfoToString}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox x:Name="QuitAtEndCheckBox" Content="{x:Static project:Resources.AutomaticallyExitWhenAllConversionsFinished}" IsChecked="{Binding ApplicationSettings.ExitApplicationWhenConversionsFinished, ElementName=window, Mode=TwoWay}" Margin="0,0,0,5" />
|
||||
|
||||
@@ -32,9 +32,11 @@ namespace FileConverter
|
||||
private OpenUrlCommand openUrlCommand;
|
||||
private DelegateCommand getChangeLogContentCommand;
|
||||
private bool displaySeeChangeLogLink = true;
|
||||
|
||||
|
||||
public SettingsWindow()
|
||||
{
|
||||
this.SupportedCultures = Helpers.GetSupportedCultures().Where(cultureInfo => cultureInfo.IsNeutralCulture).ToArray();
|
||||
|
||||
this.InitializeComponent();
|
||||
|
||||
Application application = Application.Current as Application;
|
||||
@@ -70,14 +72,6 @@ namespace FileConverter
|
||||
this.PostConversionActionComboBox.ItemsSource = postConversionActions;
|
||||
|
||||
this.InitializeCompatibleInputExtensions();
|
||||
|
||||
foreach (CultureInfo cultureInfo in Helpers.GetSupportedCulture())
|
||||
{
|
||||
if (cultureInfo.IsNeutralCulture)
|
||||
{
|
||||
this.LanguageComboBox.Items.Add(cultureInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
@@ -170,6 +164,12 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
public CultureInfo[] SupportedCultures
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string AboutSectionContent
|
||||
{
|
||||
get
|
||||
|
||||
Reference in new issue
Block a user