Skip to content

Commit 9b0f4ca

Browse files
committed
merged fom main repo
2 parents e9af00f + 086a890 commit 9b0f4ca

25 files changed

+1163
-47
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,9 @@ For more information, please see the EULAs in the [./Resources/Microsoft/ direct
110110

111111
* [Visual Studio 2013 Image Library EULA](https://github.com/retailcoder/Rubberduck/blob/master/RetailCoder.VBE/Resources/Microsoft/Visual%20Studio%202013%20Image%20Library%20EULA.rtf)
112112
* [Visual Studio 2012 Image Library EULA](https://github.com/retailcoder/Rubberduck/blob/master/RetailCoder.VBE/Resources/Microsoft/Visual%20Studio%202012%20Image%20Library%20EULA.rtf)
113+
114+
###[WPF Localization Using RESX Files](http://www.codeproject.com/Articles/35159/WPF-Localization-Using-RESX-Files)
115+
116+
This library makes localizing WPF applications at runtime using resx files a breeze. Thank you [Grant Frisken](http://www.codeproject.com/script/Membership/View.aspx?mid=1079060)!
117+
118+
> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx).

RetailCoder.VBE/App.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Rubberduck.UI.Command.MenuItems;
1717
using Rubberduck.UI.ParserErrors;
1818
using Rubberduck.VBEditor.Extensions;
19+
using Infralution.Localization.Wpf;
1920

2021
namespace Rubberduck
2122
{
@@ -189,7 +190,7 @@ private void LoadConfig()
189190
var currentCulture = RubberduckUI.Culture;
190191
try
191192
{
192-
RubberduckUI.Culture = CultureInfo.GetCultureInfo(_config.UserSettings.LanguageSetting.Code);
193+
CultureManager.UICulture = CultureInfo.GetCultureInfo(_config.UserSettings.LanguageSetting.Code);
193194
_appMenus.Localize();
194195
}
195196
catch (CultureNotFoundException exception)

RetailCoder.VBE/Extension.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Ninject.Extensions.Factory;
99
using Rubberduck.Root;
1010
using Rubberduck.UI;
11+
using System.Reflection;
12+
using System.IO;
1113

1214
namespace Rubberduck
1315
{
@@ -36,6 +38,9 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
3638
{
3739
try
3840
{
41+
AppDomain currentDomain = AppDomain.CurrentDomain;
42+
currentDomain.AssemblyResolve += LoadFromSameFolder;
43+
3944
_kernel.Load(new RubberduckModule(_kernel, (VBE)Application, (AddIn)AddInInst));
4045
_kernel.Load(new UI.SourceControl.SourceControlBindings());
4146
_kernel.Load(new CommandBarsModule(_kernel));
@@ -49,6 +54,18 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
4954
}
5055
}
5156

57+
Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
58+
{
59+
string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
60+
string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
61+
if (!File.Exists(assemblyPath))
62+
{
63+
return null;
64+
}
65+
Assembly assembly = Assembly.LoadFrom(assemblyPath);
66+
return assembly;
67+
}
68+
5269
public void OnStartupComplete(ref Array custom)
5370
{
5471
}

RetailCoder.VBE/Inspections/SelfAssignedDeclarationInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using Rubberduck.Parsing.VBA;
4+
using Rubberduck.Parsing.Symbols;
45

56
namespace Rubberduck.Inspections
67
{
@@ -18,7 +19,7 @@ public SelfAssignedDeclarationInspection(RubberduckParserState state)
1819
public override IEnumerable<CodeInspectionResultBase> GetInspectionResults()
1920
{
2021
return UserDeclarations
21-
.Where(declaration => declaration.IsSelfAssigned)
22+
.Where(declaration => declaration.IsSelfAssigned && declaration.DeclarationType == DeclarationType.Variable)
2223
.Select(issue => new SelfAssignedDeclarationInspectionResult(this, issue));
2324
}
2425
}

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@
228228
<Reference Include="extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
229229
<EmbedInteropTypes>True</EmbedInteropTypes>
230230
</Reference>
231+
<Reference Include="Infralution.Localization.Wpf">
232+
<HintPath>..\libs\Infralution.Localization.Wpf.dll</HintPath>
233+
</Reference>
231234
<Reference Include="Ninject.Extensions.Conventions">
232235
<HintPath>..\packages\ninject.extensions.conventions.3.2.0.0\lib\net45-full\Ninject.Extensions.Conventions.dll</HintPath>
233236
</Reference>

RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
1010
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
1111
xmlns:codeExplorer="clr-namespace:Rubberduck.Navigation.CodeExplorer"
12+
ResxExtension.DefaultResxName="Rubberduck.UI.RubberduckUI"
13+
Language="{UICulture}"
1214
mc:Ignorable="d"
1315
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance codeExplorer:CodeExplorerViewModel}">
1416
<UserControl.Resources>
@@ -185,11 +187,11 @@
185187
<Button Style="{StaticResource LinkButton}" Margin="4"
186188
Visibility="{Binding CanExecuteRefactorRename, Converter={StaticResource BoolToVisibility}}"
187189
Command="{Binding RefactorRenameCommand}"
188-
Content="{x:Static resx:RubberduckUI.RefactorMenu_Rename}" />
190+
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RefactorMenu_Rename}" />
189191
<Button Style="{StaticResource LinkButton}" Margin="4"
190192
Visibility="{Binding CanExecuteFindAllReferences, Converter={StaticResource BoolToVisibility}}"
191193
Command="{Binding FindAllReferencesCommand}"
192-
Content="{x:Static resx:RubberduckUI.ContextMenu_FindAllReferences}" />-->
194+
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ContextMenu_FindAllReferences}" />-->
193195
</WrapPanel>
194196
</Grid>
195197
</Border>

RetailCoder.VBE/UI/CodeInspections/InspectionResultsControl.xaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
99
xmlns:codeInspections="clr-namespace:Rubberduck.UI.CodeInspections"
1010
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
11+
ResxExtension.DefaultResxName="Rubberduck.UI.RubberduckUI"
12+
Language="{UICulture}"
1113
mc:Ignorable="d"
1214
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance codeInspections:InspectionResultsViewModel}">
1315
<UserControl.Resources>
@@ -204,7 +206,7 @@
204206
<Separator />
205207
<Menu>
206208
<MenuItem VerticalAlignment="Center"
207-
Header="{x:Static resx:RubberduckUI.Fix}"
209+
Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Fix}"
208210
ItemsSource="{Binding SelectedItem.QuickFixes}">
209211
<MenuItem.Icon>
210212
<Image Height="16" Source="../../Resources/tick.png" />
@@ -263,15 +265,15 @@
263265
<Button Style="{StaticResource LinkButton}" Margin="4"
264266
Visibility="{Binding CanExecuteQuickFixInModule, Converter={StaticResource BoolToVisibility}}"
265267
Command="{Binding QuickFixInModuleCommand}"
266-
Content="{x:Static resx:RubberduckUI.QuickFix_ThisModule}" />
268+
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=QuickFix_ThisModule}" />
267269
<Button Style="{StaticResource LinkButton}" Margin="4"
268270
Visibility="{Binding CanExecuteQuickFixInProject, Converter={StaticResource BoolToVisibility}}"
269271
Command="{Binding QuickFixInProjectCommand}"
270-
Content="{x:Static resx:RubberduckUI.QuickFix_ThisProject}" />
272+
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=QuickFix_ThisProject}" />
271273
<Button Style="{StaticResource LinkButton}" Margin="4"
272274
Visibility="{Binding CanDisableInspection, Converter={StaticResource BoolToVisibility}}"
273275
Command="{Binding DisableInspectionCommand}"
274-
Content="{x:Static resx:RubberduckUI.DisableThisInspection}" />
276+
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=DisableThisInspection}" />
275277
</WrapPanel>
276278
</StackPanel>
277279
</Border>

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerControl.xaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:resx="clr-namespace:Rubberduck.UI"
77
xmlns:toDoItems="clr-namespace:Rubberduck.UI.ToDoItems"
8-
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
9-
xmlns:groupingGrid="clr-namespace:Rubberduck.UI.Controls.GroupingGrid"
10-
x:Class="Rubberduck.UI.ToDoItems.ToDoExplorerControl"
8+
xmlns:controls="clr-namespace:Rubberduck.Controls"
9+
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" x:Class="Rubberduck.UI.ToDoItems.ToDoExplorerControl"
10+
Language="{UICulture}"
1111
mc:Ignorable="d"
1212
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type toDoItems:ToDoExplorerViewModel}, IsDesignTimeCreatable=False}">
1313
<UserControl.Resources>
1414
<BooleanToVisibilityConverter x:Key="BoolToVisibility"/>
15-
15+
1616
<BitmapImage x:Key="RefreshImage" UriSource="../../Resources/arrow-circle-double.png" />
1717
<BitmapImage x:Key="DeleteImage" UriSource="../../Resources/cross-script.png" />
1818

@@ -241,11 +241,11 @@
241241
<DockPanel LastChildFill="True">
242242
<ToolBarTray DockPanel.Dock="Top" IsLocked="True">
243243
<ToolBar Style="{DynamicResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}">
244-
<Button ToolTip="{x:Static resx:RubberduckUI.Refresh}" Command="{Binding RefreshCommand, Mode=OneWay}" BorderThickness="0" Background="Transparent">
244+
<Button ToolTip="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Refresh}" Command="{Binding RefreshCommand, Mode=OneWay}" BorderThickness="0" Background="Transparent">
245245
<Image Source="{StaticResource RefreshImage}" />
246246
</Button>
247247
<Separator />
248-
<Button ToolTip="{x:Static resx:RubberduckUI.Remove}" Command="{Binding Remove}" BorderThickness="0" Background="Transparent">
248+
<Button ToolTip="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Remove}" Command="{Binding Remove}" BorderThickness="0" Background="Transparent">
249249
<Image Source="{StaticResource DeleteImage}" />
250250
</Button>
251251
</ToolBar>
@@ -262,14 +262,14 @@
262262
<Setter Property="VerticalAlignment" Value="Center" />
263263
<Setter Property="Background" Value="Transparent" />
264264
</Style>
265-
</groupingGrid:GroupingGrid.CellStyle>
266-
<groupingGrid:GroupingGrid.Columns>
267-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.Priority}" Binding="{Binding Priority}" />
268-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_Description}" Binding="{Binding Description}" Width="*"/>
269-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ProjectName}" Binding="{Binding ProjectName}" />
270-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ModuleName}" Binding="{Binding ModuleName}" />
271-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_LineNumber}" Binding="{Binding LineNumber}" />
272-
</groupingGrid:GroupingGrid.Columns>
273-
</groupingGrid:GroupingGrid>
265+
</controls:GroupingGrid.CellStyle>
266+
<controls:GroupingGrid.Columns>
267+
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Priority}" Binding="{Binding Priority}" />
268+
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TodoExplorer_Description}" Binding="{Binding Description}" Width="*"/>
269+
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ProjectName}" Binding="{Binding ProjectName}" />
270+
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ModuleName}" Binding="{Binding ModuleName}" />
271+
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TodoExplorer_LineNumber}" Binding="{Binding LineNumber}" />
272+
</controls:GroupingGrid.Columns>
273+
</controls:GroupingGrid>
274274
</DockPanel>
275-
</UserControl>
275+
</UserControl>

RetailCoder.VBE/UI/UnitTesting/TestExplorerControl.xaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:unitTesting="clr-namespace:Rubberduck.UnitTesting"
88
xmlns:resx="clr-namespace:Rubberduck.UI"
99
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
10+
Language="{UICulture}"
1011
mc:Ignorable="d"
1112
d:DesignHeight="255" d:DesignWidth="255"
1213
MinWidth="255" MinHeight="255" d:DataContext="{d:DesignInstance local:TestExplorerViewModel}">
@@ -119,52 +120,52 @@
119120
<Separator />
120121

121122
<Menu>
122-
<MenuItem VerticalAlignment="Center" Header="{x:Static resx:RubberduckUI.Run}">
123+
<MenuItem VerticalAlignment="Center" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RubberduckUI.Run}">
123124
<MenuItem.Icon>
124125
<Image Height="16" Source="../../Resources/control.png" />
125126
</MenuItem.Icon>
126-
<MenuItem Command="{Binding RunAllTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunAllTests}">
127+
<MenuItem Command="{Binding RunAllTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunAllTests}">
127128
<MenuItem.Icon>
128129
<Image Height="16" Source="../../Resources/flask--arrow.png" />
129130
</MenuItem.Icon>
130131
</MenuItem>
131132
<Separator />
132-
<MenuItem Command="{Binding RunNotExecutedTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunNotRunTests}" >
133+
<MenuItem Command="{Binding RunNotExecutedTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunNotRunTests}" >
133134
<MenuItem.Icon>
134135
<Image Height="16" Source="../../Resources/question-white.png" />
135136
</MenuItem.Icon>
136137
</MenuItem>
137-
<MenuItem Command="{Binding RunPassedTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunPassedTests}" >
138+
<MenuItem Command="{Binding RunPassedTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunPassedTests}" >
138139
<MenuItem.Icon>
139140
<Image Height="16" Source="../../Resources/tick-circle.png" />
140141
</MenuItem.Icon>
141142
</MenuItem>
142-
<MenuItem Command="{Binding RunFailedTestsCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunFailedTests}">
143+
<MenuItem Command="{Binding RunFailedTestsCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunFailedTests}">
143144
<MenuItem.Icon>
144145
<Image Height="16" Source="../../Resources/cross-circle.png" />
145146
</MenuItem.Icon>
146147
</MenuItem>
147148
<Separator />
148-
<MenuItem Command="{Binding RepeatLastRunCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_RunLastRunTests}">
149+
<MenuItem Command="{Binding RepeatLastRunCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_RunLastRunTests}">
149150
<MenuItem.Icon>
150151
<Image Height="16" Source="../../Resources/arrow-repeat.png" />
151152
</MenuItem.Icon>
152153
</MenuItem>
153154

154155
</MenuItem>
155-
<MenuItem VerticalAlignment="Center" Header="{x:Static resx:RubberduckUI.Add}">
156+
<MenuItem VerticalAlignment="Center" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Add}">
156157
<MenuItem.Icon>
157158
<Image Height="16" Source="../../Resources/flask--plus.png" />
158159
</MenuItem.Icon>
159-
<MenuItem Command="{Binding AddTestModuleCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_AddTestModule}">
160+
<MenuItem Command="{Binding AddTestModuleCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_AddTestModule}">
160161
</MenuItem>
161162
<Separator />
162-
<MenuItem Command="{Binding AddTestMethodCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_AddTestMethod}">
163+
<MenuItem Command="{Binding AddTestMethodCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_AddTestMethod}">
163164
<MenuItem.Icon>
164165
<Image Height="16" Source="../../Resources/flask.png" />
165166
</MenuItem.Icon>
166167
</MenuItem>
167-
<MenuItem Command="{Binding AddErrorTestMethodCommand}" Header="{x:Static resx:RubberduckUI.TestExplorer_AddExpectedErrorTestMethod}">
168+
<MenuItem Command="{Binding AddErrorTestMethodCommand}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_AddExpectedErrorTestMethod}">
168169
<MenuItem.Icon>
169170
<Image Height="16" Source="../../Resources/flask--exclamation.png" />
170171
</MenuItem.Icon>
@@ -209,7 +210,7 @@
209210
<TreeView.ContextMenu>
210211
<ContextMenu>
211212
<MenuItem VerticalAlignment="Center"
212-
Header="{x:Static resx:RubberduckUI.Run}"
213+
Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Run}"
213214
Command="{Binding RunSelectedTestCommand}"
214215
IsEnabled="{Binding Model.IsReady, Mode=OneWay}">
215216
<MenuItem.Icon>

RetailCoder.VBE/UnitTesting/ProjectTestExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public static void RunMethodsWithAttribute<TAttribute>(this VBComponent componen
3636

3737
public static IEnumerable<TestMethod> TestMethods(this VBProject project)
3838
{
39-
var hostApp = project.VBE.HostApplication();
4039

4140
var result = project.VBComponents
4241
.Cast<VBComponent>()
@@ -50,7 +49,6 @@ public static IEnumerable<TestMethod> TestMethods(this VBProject project)
5049

5150
public static IEnumerable<TestMethod> TestMethods(this VBComponent component)
5251
{
53-
var hostApp = component.VBE.HostApplication();
5452

5553
if (component.Type == vbext_ComponentType.vbext_ct_StdModule
5654
&& component.CodeModule.HasAttribute<TestModuleAttribute>())

0 commit comments

Comments
 (0)