Skip to content

Commit 4a438b3

Browse files
author
Andrin Meier
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into aero2
2 parents 0a86b2a + cfa0ab5 commit 4a438b3

23 files changed

+4160
-2942
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/Inspections/UntypedFunctionUsageInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public sealed class UntypedFunctionUsageInspection : InspectionBase
1212
public UntypedFunctionUsageInspection(RubberduckParserState state)
1313
: base(state)
1414
{
15-
Severity = CodeInspectionSeverity.Hint;
15+
Severity = CodeInspectionSeverity.Warning;
1616
}
1717

1818
public override string Description { get { return RubberduckUI.UntypedFunctionUsage_; } }

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void ApplyAbstractFactoryConvention(IEnumerable<Assembly> assemblies)
132132
.Configure(binding => binding.InSingletonScope()));
133133
}
134134

135-
// note: IInspection implementations are discovered in the Rubberduck assembly via reflection.
135+
// note: InspectionBase implementations are discovered in the Rubberduck assembly via reflection.
136136
private void BindCodeInspectionTypes()
137137
{
138138
var inspections = Assembly.GetExecutingAssembly()

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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:toDoItems="clr-namespace:Rubberduck.UI.ToDoItems"
88
xmlns:controls="clr-namespace:Rubberduck.Controls"
99
xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="Rubberduck.UI.ToDoItems.ToDoExplorerControl"
10+
Language="{UICulture}"
1011
mc:Ignorable="d"
1112
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type toDoItems:ToDoExplorerViewModel}, IsDesignTimeCreatable=False}">
1213
<UserControl.Resources>
@@ -240,11 +241,11 @@
240241
<DockPanel LastChildFill="True">
241242
<ToolBarTray DockPanel.Dock="Top" IsLocked="True">
242243
<ToolBar Style="{DynamicResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}">
243-
<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">
244245
<Image Source="{StaticResource RefreshImage}" />
245246
</Button>
246247
<Separator />
247-
<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">
248249
<Image Source="{StaticResource DeleteImage}" />
249250
</Button>
250251
</ToolBar>
@@ -263,11 +264,11 @@
263264
</Style>
264265
</controls:GroupingGrid.CellStyle>
265266
<controls:GroupingGrid.Columns>
266-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.Priority}" Binding="{Binding Priority}" />
267-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_Description}" Binding="{Binding Description}" Width="*"/>
268-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ProjectName}" Binding="{Binding ProjectName}" />
269-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ModuleName}" Binding="{Binding ModuleName}" />
270-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_LineNumber}" Binding="{Binding LineNumber}" />
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}" />
271272
</controls:GroupingGrid.Columns>
272273
</controls:GroupingGrid>
273274
</DockPanel>

0 commit comments

Comments
 (0)