-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Localization updates
- Loading branch information
Showing
17 changed files
with
2,099 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="craftersmine.LeagueBalancer.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<userSettings> | ||
<craftersmine.LeagueBalancer.Settings> | ||
<setting name="Language" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</craftersmine.LeagueBalancer.Settings> | ||
</userSettings> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
craftersmine.LeagueBalancer/ApplicationSettingsWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<controls:LeagueWindow x:Class="craftersmine.LeagueBalancer.ApplicationSettingsWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:craftersmine.LeagueBalancer" | ||
xmlns:controls="clr-namespace:craftersmine.Ui.League.Controls;assembly=craftersmine.Ui.League" | ||
xmlns:globalization="clr-namespace:System.Globalization;assembly=System.Runtime" | ||
xmlns:localization="clr-namespace:craftersmine.LeagueBalancer.Localization" | ||
mc:Ignorable="d" | ||
Title="{x:Static localization:Locale.SettingsWindow_Title}" Height="250" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" | ||
Style="{StaticResource LeagueMainWindowStyle}"> | ||
<controls:LeagueWindow.Header> | ||
<TextBlock Style="{StaticResource LeagueHeaderText}" Text="{x:Static localization:Locale.SettingsWindow_Title}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="24 0 0 0"/> | ||
</controls:LeagueWindow.Header> | ||
|
||
<Grid Margin="16"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<StackPanel Grid.Row="0"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition/> | ||
<RowDefinition/> | ||
</Grid.RowDefinitions> | ||
<TextBlock Grid.Row="0" Text="{x:Static localization:Locale.SettingsWindow_Label_Language}"/> | ||
<ComboBox Grid.Row="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Static local:ApplicationSettingsWindow.Cultures}}" x:Name="SelectedLangComboBox"> | ||
<ComboBox.ItemTemplate> | ||
<DataTemplate DataType="{x:Type globalization:CultureInfo}"> | ||
<TextBlock> | ||
<Run Text="{Binding Path=DisplayName, Mode=OneWay}"/> - <Run Text="{Binding Path=EnglishName, Mode=OneWay}"/> | ||
</TextBlock> | ||
</DataTemplate> | ||
</ComboBox.ItemTemplate> | ||
</ComboBox> | ||
</Grid> | ||
</StackPanel> | ||
|
||
<Grid Grid.Row="1" Margin="8"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<Button Grid.Column="1" Content="{x:Static localization:Locale.SettingsWindow_Buttons_Ok}" Style="{StaticResource LeagueButtonThickBorder}" Height="32" Click="OnOkClick"/> | ||
</Grid> | ||
</Grid> | ||
</controls:LeagueWindow> |
49 changes: 49 additions & 0 deletions
49
craftersmine.LeagueBalancer/ApplicationSettingsWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
using craftersmine.League.CommunityDragon; | ||
using craftersmine.Ui.League.Controls; | ||
|
||
namespace craftersmine.LeagueBalancer | ||
{ | ||
public partial class ApplicationSettingsWindow : LeagueWindow | ||
{ | ||
public static ObservableCollection<CultureInfo> Cultures { get; private set; } | ||
|
||
public ApplicationSettingsWindow() | ||
{ | ||
Cultures = new ObservableCollection<CultureInfo>(); | ||
Cultures.Add(new CultureInfo("en-US")); | ||
foreach (CultureInfo info in App.GetAvailableCultures()) | ||
Cultures.Add(info); | ||
|
||
InitializeComponent(); | ||
|
||
SelectedLangComboBox.SelectedItem = SelectedLangComboBox.Items.Cast<CultureInfo>().FirstOrDefault(c => c.Name == Settings.Default.Language); | ||
} | ||
|
||
private void OnOkClick(object sender, RoutedEventArgs e) | ||
{ | ||
string lang = ((CultureInfo)SelectedLangComboBox.SelectedValue).Name; | ||
if (Settings.Default.Language == lang) | ||
MessageBox.Show("It is required to restart application in order to apply language!", | ||
"Restart required!", MessageBoxButton.OK, MessageBoxImage.Information); | ||
Settings.Default.Language = lang; | ||
Settings.Default.Save(); | ||
|
||
this.Close(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.