Skip to content

Commit d7dc80f

Browse files
committed
Internationalise
1 parent 7acde57 commit d7dc80f

8 files changed

Lines changed: 310 additions & 80 deletions

File tree

EddiCore/Hotkeys/HotkeyManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ public class HotkeyManager
1111
{
1212
private static readonly List<HotkeyAction> HotkeyActions = new List<HotkeyAction>
1313
{
14-
new HotkeyAction( "EnableEventResponses", "Enable Event Responses", () =>
14+
new HotkeyAction( "EnableEventResponses", Properties.Resources.hotkey_definition_enable_speech, () =>
1515
{
1616
EDDI.Instance.State[ "speechresponder_quiet" ] = false;
1717
} ),
18-
new HotkeyAction( "DisableEventResponses", "Disable Event Responses", () =>
18+
new HotkeyAction( "DisableEventResponses", Properties.Resources.hotkey_definition_disable_speech, () =>
1919
{
2020
EDDI.Instance.State[ "speechresponder_quiet" ] = true;
2121
SpeechService.Instance.ShutUp();
2222
} ),
23-
new HotkeyAction( "Shutup", "Stop the Current Speech", () =>
23+
new HotkeyAction( "Shutup", Properties.Resources.hotkey_definition_stop_speech, () =>
2424
{
2525
SpeechService.Instance.ShutUp();
2626
} )

EddiCore/Hotkeys/HotkeysWindow.xaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:resx="clr-namespace:EddiCore.Properties"
67
mc:Ignorable="d"
7-
Title="Configure Hotkeys"
8+
Title="{x:Static resx:Resources.hotkey_window_title}"
89
FocusManager.FocusedElement="{Binding ElementName=actionComboBox}"
910
WindowStartupLocation="CenterOwner"
1011
WindowStyle="ToolWindow"
@@ -13,31 +14,31 @@
1314
>
1415
<StackPanel Orientation="Vertical" Margin="5">
1516
<StackPanel Orientation="Horizontal" >
16-
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Action:" MinWidth="42" Margin="5" />
17+
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static resx:Resources.hotkey_action_label}" MinWidth="42" Margin="5" />
1718
<ComboBox x:Name="actionComboBox" MinWidth="273" SelectionChanged="ActionComboBoxOnSelectionChanged" Margin="5"/>
1819
</StackPanel>
1920
<StackPanel Orientation="Horizontal">
20-
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Hotkey:" MinWidth="42" Margin="5" />
21+
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static resx:Resources.hotkey_hotkey_label}" MinWidth="42" Margin="5" />
2122
<Border BorderThickness="0.5" Margin="5,5,5,5" BorderBrush="Black" Background="DarkGray">
2223
<TextBlock x:Name="hotkeyTextBlock"
23-
Text="Press the desired key combination."
24+
Text="{x:Static resx:Resources.hotkey_input_prompt}"
2425
HorizontalAlignment="Center" TextAlignment="Center" VerticalAlignment="Center"
2526
Background="WhiteSmoke"
2627
Margin="1" MinWidth="200" TextWrapping="Wrap" />
2728
</Border>
2829
<Button VerticalAlignment="Center"
29-
Content="Clear"
30+
Content="{x:Static resx:Resources.hotkey_clear_button}"
3031
Click="ClearHotkeyButton_Click"
3132
Margin="5" MinWidth ="60" />
3233
</StackPanel>
3334
<UniformGrid Rows="1" Columns="2" HorizontalAlignment="Center" Margin="5, 0" >
3435
<Button IsDefault="True"
35-
Content="OK"
36+
Content="{x:Static resx:Resources.hotkey_ok_button}"
3637
VerticalAlignment="Top"
3738
Click="acceptButtonClick"
3839
Margin="5" MinWidth ="60"/>
3940
<Button IsCancel="True"
40-
Content="Cancel"
41+
Content="{x:Static resx:Resources.hotkey_cancel_button}"
4142
VerticalAlignment="Top"
4243
Click="cancelButtonClick"
4344
Margin="5" MinWidth ="60"/>

EddiCore/Hotkeys/HotkeysWindow.xaml.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void ActionComboBoxOnSelectionChanged ( object sender, SelectionChangedE
4444
{
4545
hotkeyTextBlock.Text = selectedAction.KeyGesture != null
4646
? selectedAction.KeyGesture.GetDisplayStringForCulture( CultureInfo.CurrentCulture )
47-
: "Press the desired key combination.";
47+
: Properties.Resources.hotkey_input_prompt;
4848
}
4949
}
5050

@@ -55,11 +55,11 @@ private void HotkeysWindow_KeyDown ( object sender, KeyEventArgs e )
5555
{
5656
pressedKeys.Clear();
5757
currentKeyGesture = null;
58-
hotkeyTextBlock.Text = "Hotkey registration canceled.";
58+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_cancelled;
5959
Task.Run( () =>
6060
{
6161
Task.Delay( TimeSpan.FromSeconds( 5 ) );
62-
hotkeyTextBlock.Text = "Press the desired key combination.";
62+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_prompt;
6363
} );
6464
e.Handled = true;
6565
return;
@@ -106,14 +106,14 @@ private bool IsKeyGestureValid ( HashSet<Key> keys, ModifierKeys modifiers )
106106
// Disallow combinations with only modifier keys
107107
if ( primaryKeys.Count == 0 )
108108
{
109-
hotkeyTextBlock.Text = "A non-modifier key is required.";
109+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_need_nonmodifier;
110110
return false;
111111
}
112112

113113
// Disallow combinations with multiple primary keys
114114
if ( primaryKeys.Count > 1 )
115115
{
116-
hotkeyTextBlock.Text = "Only one non-modifier key is permitted.";
116+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_need_one_nonmodifier;
117117
return false;
118118
}
119119

@@ -124,7 +124,7 @@ private bool IsKeyGestureValid ( HashSet<Key> keys, ModifierKeys modifiers )
124124
if ( modifiers == ModifierKeys.None &&
125125
( ( key >= Key.A && key <= Key.Z ) || ( key >= Key.D0 && key <= Key.D9 ) ) )
126126
{
127-
hotkeyTextBlock.Text = "Please add a modifier key (Ctrl, Alt, Shift).";
127+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_need_modifier;
128128
return false;
129129
}
130130

@@ -134,7 +134,7 @@ private bool IsKeyGestureValid ( HashSet<Key> keys, ModifierKeys modifiers )
134134
( key >= Key.NumPad0 && key <= Key.NumPad9 ) ||
135135
key.ToString().StartsWith( "Oem" ) ) )
136136
{
137-
hotkeyTextBlock.Text = "Please add another modifier key (Ctrl, Alt).";
137+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_need_more_modifiers;
138138
return false;
139139
}
140140

@@ -143,15 +143,15 @@ private bool IsKeyGestureValid ( HashSet<Key> keys, ModifierKeys modifiers )
143143
( modifiers == ( ModifierKeys.Control | ModifierKeys.Alt ) && key == Key.Delete ) ||
144144
( modifiers == ModifierKeys.Control && ( key == Key.C || key == Key.V || key == Key.X ) ) )
145145
{
146-
hotkeyTextBlock.Text = "This key combination is reserved by the system.";
146+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_reserved;
147147
return false;
148148
}
149149

150150
// Disallow duplicate hotkeys
151151
if ( actionComboBox.SelectedItem is HotkeyAction selectedAction &&
152152
HotkeyActionCollection.IsKeyGestureAssigned(selectedAction.Name, key, modifiers) )
153153
{
154-
hotkeyTextBlock.Text = "This key combination is already assigned to another action.";
154+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_already_used;
155155
return false;
156156
}
157157

@@ -176,7 +176,7 @@ private void HotkeysWindow_KeyUp ( object sender, KeyEventArgs e )
176176
}
177177
else
178178
{
179-
hotkeyTextBlock.Text = "Press the desired key combination.";
179+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_prompt;
180180
}
181181
}
182182

@@ -213,7 +213,7 @@ private void ClearHotkeyButton_Click ( object sender, RoutedEventArgs e )
213213
if ( actionComboBox.SelectedItem is HotkeyAction hotkeyAction )
214214
{
215215
hotkeyAction.KeyGesture = null;
216-
hotkeyTextBlock.Text = "Press the desired key combination.";
216+
hotkeyTextBlock.Text = Properties.Resources.hotkey_input_prompt;
217217
}
218218
}
219219
}

EddiCore/Properties/Resources.Designer.cs

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EddiCore/Properties/Resources.resx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,70 @@ Please close the other instance and try again.</value>
145145
<data name="download_failed" xml:space="preserve">
146146
<value>Download failed. Please try again later.</value>
147147
</data>
148+
<data name="hotkey_action_label" xml:space="preserve">
149+
<value>Action:</value>
150+
<comment>Label for the dropdown menu of actions</comment>
151+
</data>
152+
<data name="hotkey_cancel_button" xml:space="preserve">
153+
<value>Cancel</value>
154+
</data>
155+
<data name="hotkey_clear_button" xml:space="preserve">
156+
<value>Clear</value>
157+
</data>
158+
<data name="hotkey_definition_disable_speech" xml:space="preserve">
159+
<value>Disable Speech</value>
160+
<comment>hotkey that disables the Speech Manager</comment>
161+
</data>
162+
<data name="hotkey_definition_enable_speech" xml:space="preserve">
163+
<value>Enable Speech</value>
164+
<comment>hotkey that enables the Speech Manager</comment>
165+
</data>
166+
<data name="hotkey_definition_stop_speech" xml:space="preserve">
167+
<value>Stop the Current Speech</value>
168+
<comment>hotkey that stops the current speech</comment>
169+
</data>
170+
<data name="hotkey_hotkey_label" xml:space="preserve">
171+
<value>Hotkey:</value>
172+
<comment>Label for the selected hotkey</comment>
173+
</data>
174+
<data name="hotkey_input_need_more_modifiers" xml:space="preserve">
175+
<value>Please add another modifier key (Ctrl, Alt).</value>
176+
<comment>Shown when the hotkey combination needs a modifier key besides Shift</comment>
177+
</data>
178+
<data name="hotkey_input_already_used" xml:space="preserve">
179+
<value>This key combination is already assigned to another action.</value>
180+
<comment>Shown when the user tries to input a combination that is already in use</comment>
181+
</data>
182+
<data name="hotkey_input_cancelled" xml:space="preserve">
183+
<value>Hotkey registration cancelled.</value>
184+
<comment>Shown when the users cancels hotkey registration by pressing Escape</comment>
185+
</data>
186+
<data name="hotkey_input_need_modifier" xml:space="preserve">
187+
<value>Please add a modifier key (Ctrl, Alt, Shift).</value>
188+
<comment>Shown when the hotkey combination needs a modifier key</comment>
189+
</data>
190+
<data name="hotkey_input_need_nonmodifier" xml:space="preserve">
191+
<value>A non-modifier key is required.</value>
192+
<comment>Shown when the user is pressing only modifier keys</comment>
193+
</data>
194+
<data name="hotkey_input_need_one_nonmodifier" xml:space="preserve">
195+
<value>Only one non-modifier key is permitted.</value>
196+
<comment>Shown when the user is pressing more than one modifier key</comment>
197+
</data>
198+
<data name="hotkey_input_prompt" xml:space="preserve">
199+
<value>Press the desired key combination.</value>
200+
</data>
201+
<data name="hotkey_input_reserved" xml:space="preserve">
202+
<value>This key combination is reserved by the system.</value>
203+
<comment>Shown when the user tries to input a reserved key combination</comment>
204+
</data>
205+
<data name="hotkey_ok_button" xml:space="preserve">
206+
<value>OK</value>
207+
</data>
208+
<data name="hotkey_window_title" xml:space="preserve">
209+
<value>Configure Hotkeys</value>
210+
<comment>The title of the Configure Hotkeys window</comment>
211+
</data>
148212
<data name="mandatory_upgrade" xml:space="preserve">
149213
<value>Mandatory Eddi upgrade to {0} is required.</value>
150214
</data>

0 commit comments

Comments
 (0)