Skip to content

Commit

Permalink
3.0.5635.15843
Browse files Browse the repository at this point in the history
  • Loading branch information
Icehunter committed Jun 6, 2015
1 parent 2a4de7d commit c4e8c89
Show file tree
Hide file tree
Showing 20 changed files with 262 additions and 88 deletions.
29 changes: 8 additions & 21 deletions FFXIVAPP.Client/App.cs
Expand Up @@ -33,12 +33,10 @@
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Threading;
using System.Xml;
using System.Xml.Linq;
Expand Down Expand Up @@ -162,12 +160,12 @@ private static void ConfigureNLog()
if (hasLocal)
{
stringReader = new StringReader(XElement.Load(fileName)
.ToString());
.ToString());
}
else
{
stringReader = new StringReader(XElement.Load(resource.Stream)
.ToString());
.ToString());
}
using (var xmlReader = XmlReader.Create(stringReader))
{
Expand Down Expand Up @@ -213,25 +211,14 @@ private static void SettingsPropertyChanged(object sender, PropertyChangedEventA
break;
case "GameLanguage":
Constants.GameLanguage = Settings.Default.GameLanguage;
var lang = Settings.Default.GameLanguage.ToLower();
var cultureInfo = new CultureInfo("en");
switch (lang)
break;
case "UILanguage":
if (AppViewModel.Instance.UILanguages.Any(ui => ui.Language == Settings.Default.UILanguage))
{
case "french":
cultureInfo = new CultureInfo("fr");
break;
case "japanese":
cultureInfo = new CultureInfo("ja");
break;
case "german":
cultureInfo = new CultureInfo("de");
break;
case "chinese":
cultureInfo = new CultureInfo("zh");
break;
var uiLanguage = AppViewModel.Instance.UILanguages.First(ui => ui.Language == Settings.Default.UILanguage);
Constants.CultureInfo = Settings.Default.Culture = uiLanguage.CultureInfo;
LocaleHelper.Update(Settings.Default.Culture);
}
Constants.CultureInfo = Settings.Default.Culture = cultureInfo;
LocaleHelper.Update(Settings.Default.Culture);
break;
case "ServerName":
Constants.ServerName = Settings.Default.ServerName;
Expand Down
43 changes: 43 additions & 0 deletions FFXIVAPP.Client/AppBootstrapper.cs
Expand Up @@ -31,8 +31,11 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Timers;
using FFXIVAPP.Client.Models;
using FFXIVAPP.Client.Properties;
using FFXIVAPP.Client.Views;
using FFXIVAPP.Common.Utilities;
using NLog;
Expand Down Expand Up @@ -107,6 +110,46 @@ private AppBootstrapper()
AppViewModel.Instance.SettingsPath = Common.Constants.SettingsPath;
AppViewModel.Instance.PluginsSettingsPath = Common.Constants.PluginsSettingsPath;

#region Culture BootStrapping

AppViewModel.Instance.UILanguages.Add(new UILanguage
{
Language = "English",
ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/en.png",
Title = "English",
CultureInfo = new CultureInfo("en")
});
AppViewModel.Instance.UILanguages.Add(new UILanguage
{
Language = "Japanese",
ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/ja.png",
Title = "日本語",
CultureInfo = new CultureInfo("ja")
});
AppViewModel.Instance.UILanguages.Add(new UILanguage
{
Language = "French",
ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/fr.png",
Title = "Français",
CultureInfo = new CultureInfo("fr")
});
AppViewModel.Instance.UILanguages.Add(new UILanguage
{
Language = "German",
ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/de.png",
Title = "Deutsch",
CultureInfo = new CultureInfo("de")
});
AppViewModel.Instance.UILanguages.Add(new UILanguage
{
Language = "Chinese",
ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/cn.png",
Title = "中國",
CultureInfo = new CultureInfo("zh")
});

#endregion

#region Initial BootStrapping

Initializer.SetupCurrentUICulture();
Expand Down
17 changes: 17 additions & 0 deletions FFXIVAPP.Client/AppViewModel.cs
Expand Up @@ -40,6 +40,7 @@
using System.Windows.Forms;
using System.Windows.Threading;
using FFXIVAPP.Client.Memory;
using FFXIVAPP.Client.Models;
using FFXIVAPP.Client.Properties;
using FFXIVAPP.Common.Core.Memory;
using FFXIVAPP.Common.Helpers;
Expand Down Expand Up @@ -76,6 +77,22 @@ internal sealed class AppViewModel : INotifyPropertyChanged
private Style _tabControlCollapsedHeader;
private List<string> _updateNotes;

#region UILanguages

private ObservableCollection<UILanguage> _uiLanguages;

public ObservableCollection<UILanguage> UILanguages
{
get { return _uiLanguages ?? (_uiLanguages = new ObservableCollection<UILanguage>()); }
set
{
_uiLanguages = value;
RaisePropertyChanged();
}
}

#endregion

public static AppViewModel Instance
{
get { return _instance ?? (_instance = new AppViewModel()); }
Expand Down
1 change: 1 addition & 0 deletions FFXIVAPP.Client/FFXIVAPP.Client.csproj
Expand Up @@ -178,6 +178,7 @@
<Compile Include="Memory\ChatLogWorker.cs" />
<Compile Include="Models\PluginSourceItem.cs" />
<Compile Include="Models\PluginStatus.cs" />
<Compile Include="Models\UILanguage.cs" />
<Compile Include="Models\WindowsMessageEvents.cs" />
<Compile Include="Network\IPHelper.cs" />
<Compile Include="Network\NetworkWorker.cs" />
Expand Down
3 changes: 3 additions & 0 deletions FFXIVAPP.Client/Localization/Chinese.cs
Expand Up @@ -127,6 +127,9 @@ public static ResourceDictionary Context()
Dictionary.Add("app_pluginUpdateMessageText", "看來某些插件有更新。為了確保兼容性, 請在 \"更新\" 選項內更新插件.");
Dictionary.Add("app_CurrentVersionHeader", "现在");
Dictionary.Add("app_LatestVersionHeader", "最新");
Dictionary.Add("app_UILanguageChangeWarningGeneral", "Do you want to change the GameLanguage setting as well to match this applications UILanguage? If you cancel you will manually have to change GameLanguage in Settings later.");
Dictionary.Add("app_UILanguageChangeWarningChinese", " When changing to or from Chinese an application restart is also required.");
Dictionary.Add("app_UILanguageChangeWarningNoGameLanguage", "The selected UILanguage does not have a supported GameLanguage. Please choose your game language in Settings.");
return Dictionary;
}
}
Expand Down
3 changes: 3 additions & 0 deletions FFXIVAPP.Client/Localization/English.cs
Expand Up @@ -127,6 +127,9 @@ public static ResourceDictionary Context()
Dictionary.Add("app_pluginUpdateMessageText", "It appears some plugins have updates available. To ensure compatibility please update at your earliest convenience via the \"Update\" tab.");
Dictionary.Add("app_CurrentVersionHeader", "Current");
Dictionary.Add("app_LatestVersionHeader", "Latest");
Dictionary.Add("app_UILanguageChangeWarningGeneral", "Do you want to change the GameLanguage setting as well to match this applications UILanguage? If you cancel you will manually have to change GameLanguage in Settings later.");
Dictionary.Add("app_UILanguageChangeWarningChinese", " When changing to or from Chinese an application restart is also required.");
Dictionary.Add("app_UILanguageChangeWarningNoGameLanguage", "The selected UILanguage does not have a supported GameLanguage. Please choose your game language in Settings.");
return Dictionary;
}
}
Expand Down
3 changes: 3 additions & 0 deletions FFXIVAPP.Client/Localization/French.cs
Expand Up @@ -127,6 +127,9 @@ public static ResourceDictionary Context()
Dictionary.Add("app_pluginUpdateMessageText", "Il semble que certains plugins aient des mises à jour disponibles. Pour vous assurer de leur compatibilité, veuillez les mettre à jour à votre meilleure convenance via le tab \"Mises à jour\"");
Dictionary.Add("app_CurrentVersionHeader", "Actuelle");
Dictionary.Add("app_LatestVersionHeader", "Dernière");
Dictionary.Add("app_UILanguageChangeWarningGeneral", "Do you want to change the GameLanguage setting as well to match this applications UILanguage? If you cancel you will manually have to change GameLanguage in Settings later.");
Dictionary.Add("app_UILanguageChangeWarningChinese", " When changing to or from Chinese an application restart is also required.");
Dictionary.Add("app_UILanguageChangeWarningNoGameLanguage", "The selected UILanguage does not have a supported GameLanguage. Please choose your game language in Settings.");
return Dictionary;
}
}
Expand Down
3 changes: 3 additions & 0 deletions FFXIVAPP.Client/Localization/German.cs
Expand Up @@ -127,6 +127,9 @@ public static ResourceDictionary Context()
Dictionary.Add("app_pluginUpdateMessageText", "It appears some plugins have updates available. To ensure compatibility please update at your earliest convenience via the \"Update\" tab.");
Dictionary.Add("app_CurrentVersionHeader", "Current");
Dictionary.Add("app_LatestVersionHeader", "Latest");
Dictionary.Add("app_UILanguageChangeWarningGeneral", "Do you want to change the GameLanguage setting as well to match this applications UILanguage? If you cancel you will manually have to change GameLanguage in Settings later.");
Dictionary.Add("app_UILanguageChangeWarningChinese", " When changing to or from Chinese an application restart is also required.");
Dictionary.Add("app_UILanguageChangeWarningNoGameLanguage", "The selected UILanguage does not have a supported GameLanguage. Please choose your game language in Settings.");
return Dictionary;
}
}
Expand Down
3 changes: 3 additions & 0 deletions FFXIVAPP.Client/Localization/Japanese.cs
Expand Up @@ -127,6 +127,9 @@ public static ResourceDictionary Context()
Dictionary.Add("app_pluginUpdateMessageText", "いくつかのプラグインに利用可能な最新の更新があります。全体の動作を保証するために\"更新する\"タブから更新を行って下さい。");
Dictionary.Add("app_CurrentVersionHeader", "現在");
Dictionary.Add("app_LatestVersionHeader", "最新");
Dictionary.Add("app_UILanguageChangeWarningGeneral", "Do you want to change the GameLanguage setting as well to match this applications UILanguage? If you cancel you will manually have to change GameLanguage in Settings later.");
Dictionary.Add("app_UILanguageChangeWarningChinese", " When changing to or from Chinese an application restart is also required.");
Dictionary.Add("app_UILanguageChangeWarningNoGameLanguage", "The selected UILanguage does not have a supported GameLanguage. Please choose your game language in Settings.");
return Dictionary;
}
}
Expand Down
41 changes: 41 additions & 0 deletions FFXIVAPP.Client/Models/UILanguage.cs
@@ -0,0 +1,41 @@
// FFXIVAPP.Client
// UILanguage.cs
//
// Copyright © 2007 - 2015 Ryan Wilson - All Rights Reserved
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of SyndicatedLife nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

using System.Globalization;

namespace FFXIVAPP.Client.Models
{
public class UILanguage
{
public string Language { get; set; }
public string ImageURI { get; set; }
public string Title { get; set; }
public CultureInfo CultureInfo { get; set; }
}
}
12 changes: 12 additions & 0 deletions FFXIVAPP.Client/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions FFXIVAPP.Client/Properties/Settings.settings
Expand Up @@ -259,5 +259,8 @@
<Setting Name="EnableNetworkReading" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="UILanguage" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
62 changes: 22 additions & 40 deletions FFXIVAPP.Client/ShellView.xaml
Expand Up @@ -63,46 +63,28 @@

<MetroControls:MetroWindow.RightWindowCommands>
<MetroControls:WindowCommands>
<Button Command="{Binding SetLocaleCommand}"
CommandParameter="English">
<Image Width="20"
Height="20"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/FFXIVAPP.Client;component/Resources/Media/Icons/en.png"
ToolTip="English" />
</Button>
<Button Command="{Binding SetLocaleCommand}"
CommandParameter="Japanese">
<Image Width="20"
Height="20"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/FFXIVAPP.Client;component/Resources/Media/Icons/ja.png"
ToolTip="日本語" />
</Button>
<Button Command="{Binding SetLocaleCommand}"
CommandParameter="French">
<Image Width="20"
Height="20"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/FFXIVAPP.Client;component/Resources/Media/Icons/fr.png"
ToolTip="Français" />
</Button>
<Button Command="{Binding SetLocaleCommand}"
CommandParameter="German">
<Image Width="20"
Height="20"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/FFXIVAPP.Client;component/Resources/Media/Icons/de.png"
ToolTip="Deutsch" />
</Button>
<Button Command="{Binding SetLocaleCommand}"
CommandParameter="Chinese">
<Image Width="20"
Height="20"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/FFXIVAPP.Client;component/Resources/Media/Icons/cn.png"
ToolTip="中國" />
</Button>
<ComboBox x:Name="LanguageSelect"
MinWidth="120"
IsReadOnly="False"
ItemsSource="{Binding UILanguages,
Source={StaticResource AppProperties}}"
SelectedValue="{Binding UILanguage,
Source={x:Static Properties:Settings.Default}}"
SelectedValuePath="Language"
Utilities:SelectionBehavior.SelectionChanged="{Binding SetLocaleCommand}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Width="20"
RenderOptions.BitmapScalingMode="HighQuality"
Source="{Binding ImageURI}" />
<TextBlock Margin="5 0"
Foreground="Black"
Text="{Binding Title}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button x:Name="save"
Command="{Binding SaveAndClearHistoryCommand}">
<StackPanel Orientation="Horizontal">
Expand Down
13 changes: 11 additions & 2 deletions FFXIVAPP.Client/ShellView.xaml.cs
Expand Up @@ -78,11 +78,19 @@ private void MetroWindowLoaded(object sender, RoutedEventArgs e)
{
View.Topmost = Settings.Default.TopMost;

LocaleHelper.Update(Settings.Default.Culture);
ThemeHelper.ChangeTheme(Settings.Default.Theme, null);

#region GUI Finalization

if (String.IsNullOrWhiteSpace(Settings.Default.UILanguage))
{
Settings.Default.UILanguage = Settings.Default.GameLanguage;
}
else
{
LocaleHelper.Update(Settings.Default.Culture);
}

Initializer.LoadAvailableSources();
Initializer.LoadAvailablePlugins();
Initializer.CheckUpdates();
Expand Down Expand Up @@ -141,7 +149,8 @@ public static void CloseApplication(bool update = false)
{
Application.Current.MainWindow.WindowState = WindowState.Normal;
SettingsHelper.Save(update);
foreach (var pluginInstance in App.Plugins.Loaded.Cast<PluginInstance>().Where(pluginInstance => pluginInstance.Loaded))
foreach (var pluginInstance in App.Plugins.Loaded.Cast<PluginInstance>()
.Where(pluginInstance => pluginInstance.Loaded))
{
pluginInstance.Instance.Dispose(update);
}
Expand Down

0 comments on commit c4e8c89

Please sign in to comment.