diff --git a/Application/FileConverter/FileConverter.csproj b/Application/FileConverter/FileConverter.csproj
index 7ae4163..7dd801f 100644
--- a/Application/FileConverter/FileConverter.csproj
+++ b/Application/FileConverter/FileConverter.csproj
@@ -107,14 +107,14 @@
+
-
- Resources.en.resx
+
True
True
- True
+ Resources.fr.resx
@@ -210,9 +210,9 @@
Settings.settings
True
-
+
PublicResXFileCodeGenerator
- Resources.en.Designer.cs
+ Resources.fr1.Designer.cs
PublicResXFileCodeGenerator
diff --git a/Application/FileConverter/Helpers.cs b/Application/FileConverter/Helpers.cs
new file mode 100644
index 0000000..eee12f3
--- /dev/null
+++ b/Application/FileConverter/Helpers.cs
@@ -0,0 +1,26 @@
+// // License: http://www.gnu.org/licenses/gpl.html GPL version 3.
+
+namespace FileConverter
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.IO;
+ using System.Linq;
+ using System.Reflection;
+
+ public static class Helpers
+ {
+ public static IEnumerable GetSupportedCulture()
+ {
+ //Get all culture
+ CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
+
+ //Find the location where application installed.
+ string exeLocation = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
+
+ //Return all culture for which satellite folder found with culture code.
+ return cultures.Where(cultureInfo => Directory.Exists(Path.Combine(exeLocation, cultureInfo.Name)));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Application/FileConverter/Properties/Resources.fr.resx b/Application/FileConverter/Properties/Resources.fr.resx
index 6308e9a..018df5b 100644
--- a/Application/FileConverter/Properties/Resources.fr.resx
+++ b/Application/FileConverter/Properties/Resources.fr.resx
@@ -296,7 +296,7 @@ Special paths:
See change log ...
- Settings
+ Paramètres
Settings
diff --git a/Application/FileConverter/Settings.Settings.cs b/Application/FileConverter/Settings.Settings.cs
index 28eee9d..3084a4c 100644
--- a/Application/FileConverter/Settings.Settings.cs
+++ b/Application/FileConverter/Settings.Settings.cs
@@ -1,5 +1,9 @@
// License: http://www.gnu.org/licenses/gpl.html GPL version 3.
+using System.Globalization;
+using System.Windows;
+using System.Windows.Markup;
+
namespace FileConverter
{
using System.Collections.ObjectModel;
@@ -14,6 +18,7 @@ namespace FileConverter
private float durationBetweenEndOfConversionsAndApplicationExit = 3f;
private ObservableCollection conversionPresets = new ObservableCollection();
private bool checkUpgradeAtStartup = true;
+ private CultureInfo applicationLanguage;
[XmlAttribute]
public int SerializationVersion
@@ -22,6 +27,57 @@ namespace FileConverter
set;
} = Version;
+ [XmlIgnore]
+ public CultureInfo ApplicationLanguage
+ {
+ get
+ {
+ return this.applicationLanguage;
+ }
+
+ set
+ {
+ if (this.applicationLanguage != null && this.applicationLanguage.Equals(value))
+ {
+ return;
+ }
+
+ this.applicationLanguage = value;
+ if (this.applicationLanguage != null)
+ {
+ System.Threading.Thread.CurrentThread.CurrentCulture = this.applicationLanguage;
+ System.Threading.Thread.CurrentThread.CurrentUICulture = this.applicationLanguage;
+ }
+
+ this.OnPropertyChanged();
+ }
+ }
+
+ [XmlElement]
+ public string ApplicationLanguageName
+ {
+ get
+ {
+ if (this.ApplicationLanguage == null)
+ {
+ return string.Empty;
+ }
+
+ return this.ApplicationLanguage.Name;
+ }
+
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ this.ApplicationLanguage = null;
+ return;
+ }
+
+ this.ApplicationLanguage = CultureInfo.GetCultureInfo(value);
+ }
+ }
+
[XmlIgnore]
public ObservableCollection ConversionPresets
{
@@ -107,6 +163,35 @@ namespace FileConverter
{
this.ConversionPresets[index].OnDeserializationComplete();
}
+
+ // Initialize application if it was not deserialized from the settings.
+ if (this.ApplicationLanguage == null)
+ {
+ CultureInfo bestCandidate = null;
+ CultureInfo currentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
+ foreach (CultureInfo culture in Helpers.GetSupportedCulture())
+ {
+ if (culture.Equals(currentUICulture))
+ {
+ bestCandidate = culture;
+ break;
+ }
+ else if (culture.Equals(currentUICulture.Parent))
+ {
+ bestCandidate = culture;
+ }
+ }
+
+ if (bestCandidate != null)
+ {
+ this.ApplicationLanguage = bestCandidate;
+ }
+ else
+ {
+ Diagnostics.Debug.Log("Can't find supported culture info for culture {0}. Fallback to default culture.", currentUICulture);
+ this.ApplicationLanguage = CultureInfo.GetCultureInfo("en");
+ }
+ }
}
}
}
diff --git a/Application/FileConverter/Windows/SettingsWindow.xaml b/Application/FileConverter/Windows/SettingsWindow.xaml
index 98d1a26..502e6db 100644
--- a/Application/FileConverter/Windows/SettingsWindow.xaml
+++ b/Application/FileConverter/Windows/SettingsWindow.xaml
@@ -755,6 +755,11 @@
+
+
+
+
+
diff --git a/Application/FileConverter/Windows/SettingsWindow.xaml.cs b/Application/FileConverter/Windows/SettingsWindow.xaml.cs
index 91b4baa..ad241a2 100644
--- a/Application/FileConverter/Windows/SettingsWindow.xaml.cs
+++ b/Application/FileConverter/Windows/SettingsWindow.xaml.cs
@@ -1,10 +1,12 @@
// License: http://www.gnu.org/licenses/gpl.html GPL version 3.
+
namespace FileConverter
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
+ using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
@@ -13,7 +15,6 @@ namespace FileConverter
using FileConverter.Annotations;
using FileConverter.Commands;
- using FileConverter.Upgrade;
using Microsoft.Win32;
///
@@ -69,11 +70,19 @@ 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;
- public event System.EventHandler OnSettingsWindowHide;
+ public event EventHandler OnSettingsWindowHide;
public ICommand OpenUrlCommand
{
@@ -190,7 +199,7 @@ namespace FileConverter
this.OnPropertyChanged();
}
}
-
+
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
@@ -200,7 +209,7 @@ namespace FileConverter
private void DownloadChangeLogAction()
{
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
- Helpers.GetChangeLogAsync(new UpgradeVersionDescription(), this.OnChangeLogRetrieved);
+ Upgrade.Helpers.GetChangeLogAsync(new UpgradeVersionDescription(), this.OnChangeLogRetrieved);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
this.AboutSectionContent = "###Downloading change log ...";
this.DisplaySeeChangeLogLink = false;