Skip to content

Commit bf2af83

Browse files
committed
fix some localization issues (#1675)
* added AsTypeName to the context-sensitive commandbar * clear built-in references at every resolution; fixed issue with null parse trees, given built-in modules get a module state instance. * fixed OverflowException in GetTypeName; built-in parameters now have return type info :) * returning built-in members now have return type info as well * removed hard-coded defaults in ClassModuleDeclaration * added IsBadReadPtr check in COM declarations collector * Implemented CanExecute in Project Explorer rename command * cleaned up FormDesignerRefactorRename command * fixed IOExceptions in QualifiedModuleName * use filename, not buildfilename * GetDisplayName being the part in parens, should be null when not applicable; made it private * renamed namespace Rubberduck.UI.CodeInspections to Rubberduck.UI.Inspections for consistency with Rubberduck.Inspections namespace * changed background color of bottom panel in CodeExplorer and InspectionResults toolwindows * fixed broken keybinding "Esc" -> "Escape" * added copy/export button to SearchView (todo: implement ExecuteCopyResultsCommand) * Revert "added copy/export button to SearchView (todo: implement ExecuteCopyResultsCommand)" This reverts commit e9946b7. * assert ProjectId isn't null * fixes #1664 * some French translations * fixed possible NRE's in QualifiedModuleName * fixes #1671 * changed wording of fr resources for settings dialog (left pane items) * fixes #1672
1 parent 05b3d97 commit bf2af83

File tree

15 files changed

+945
-510
lines changed

15 files changed

+945
-510
lines changed

RetailCoder.VBE/App.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Runtime.InteropServices.ComTypes;
1919
using System.Threading.Tasks;
2020
using System.Windows.Forms;
21+
using Rubberduck.Common.Hotkeys;
2122

2223
namespace Rubberduck
2324
{
@@ -132,9 +133,9 @@ private bool ShouldEvaluateCanExecute(Declaration selectedDeclaration, ParserSta
132133
private void _configService_SettingsChanged(object sender, EventArgs e)
133134
{
134135
_config = _configService.LoadConfiguration();
136+
_hooks.HookHotkeys();
135137
// also updates the ShortcutKey text
136138
_appMenus.Localize();
137-
_hooks.HookHotkeys();
138139
UpdateLoggingLevel();
139140
}
140141

@@ -147,9 +148,9 @@ public void Startup()
147148
{
148149
CleanReloadConfig();
149150
_appMenus.Initialize();
151+
_hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts
150152
_appMenus.Localize();
151153
Task.Delay(1000).ContinueWith(t => UiDispatcher.Invoke(() => _parser.State.OnParseRequested(this))).ConfigureAwait(false);
152-
_hooks.HookHotkeys();
153154
UpdateLoggingLevel();
154155
}
155156

RetailCoder.VBE/Common/Hotkeys/Hotkey.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows.Input;
66
using Rubberduck.Common.WinAPI;
77
using NLog;
8+
using Rubberduck.UI.Command;
89

910
namespace Rubberduck.Common.Hotkeys
1011
{
@@ -58,6 +59,7 @@ public void Attach()
5859
}
5960

6061
HookKey(key, shift);
62+
SetCommandShortcutText();
6163
}
6264

6365
public void Detach()
@@ -71,6 +73,7 @@ public void Detach()
7173
Kernel32.GlobalDeleteAtom(HotkeyInfo.HookId);
7274

7375
IsAttached = false;
76+
ClearCommandShortcutText();
7477
}
7578

7679
private void HookKey(Keys key, uint shift)
@@ -90,9 +93,29 @@ private void HookKey(Keys key, uint shift)
9093

9194
HotkeyInfo = new HotkeyInfo(hookId, Combo);
9295
IsAttached = true;
96+
9397
_logger.Debug("Hotkey '{0}' hooked successfully to command '{1}'", Key, Command.GetType()); //no translation needed for Debug.Writeline
9498
}
9599

100+
private void SetCommandShortcutText()
101+
{
102+
var command = Command as CommandBase;
103+
if (command != null)
104+
{
105+
command.ShortcutText = HotkeyInfo.ToString();
106+
}
107+
}
108+
109+
private void ClearCommandShortcutText()
110+
{
111+
var command = Command as CommandBase;
112+
if (command != null)
113+
{
114+
command.ShortcutText = string.Empty;
115+
}
116+
}
117+
118+
96119
private static readonly IDictionary<char,uint> Modifiers = new Dictionary<char, uint>
97120
{
98121
{ '+', (uint)KeyModifier.SHIFT },

RetailCoder.VBE/Common/Hotkeys/HotkeyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ public override string ToString()
2525
var builder = new StringBuilder();
2626
if (_keys.HasFlag(Keys.Alt))
2727
{
28-
builder.Append("Alt");
28+
builder.Append(Rubberduck.UI.RubberduckUI.GeneralSettings_HotkeyAlt);
2929
builder.Append('+');
3030
}
3131
if (_keys.HasFlag(Keys.Control))
3232
{
33-
builder.Append("Ctrl");
33+
builder.Append(Rubberduck.UI.RubberduckUI.GeneralSettings_HotkeyCtrl);
3434
builder.Append('+');
3535
}
3636
if (_keys.HasFlag(Keys.Shift))
3737
{
38-
builder.Append("Shift");
38+
builder.Append(Rubberduck.UI.RubberduckUI.GeneralSettings_HotkeyShift);
3939
builder.Append('+');
4040
}
4141
builder.Append(_keys & ~Modifiers);

RetailCoder.VBE/Inspections/InspectionsUI.de.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
62+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>

0 commit comments

Comments
 (0)