Skip to content

Commit a6ff22b

Browse files
committed
added translation for GitProvider exception messages
1 parent 511f4b2 commit a6ff22b

8 files changed

+901
-22
lines changed

Rubberduck.SourceControl/GitProvider.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public GitProvider(VBProject project, IRepository repository, ICodePaneWrapperFa
3737
}
3838
catch (RepositoryNotFoundException ex)
3939
{
40-
throw new SourceControlException("Repository not found.", ex);
40+
throw new SourceControlException(SourceControlText.GitRepoNotFound, ex);
4141
}
4242
}
4343

@@ -114,7 +114,7 @@ public override IRepository Clone(string remotePathOrUrl, string workingDirector
114114
}
115115
catch (LibGit2SharpException ex)
116116
{
117-
throw new SourceControlException("Failed to clone remote repository.", ex);
117+
throw new SourceControlException(SourceControlText.GitRepoNotCloned, ex);
118118
}
119119
}
120120

@@ -130,7 +130,7 @@ public override IRepository Init(string directory, bool bare = false)
130130
}
131131
catch (LibGit2SharpException ex)
132132
{
133-
throw new SourceControlException("Unable to initialize repository.", ex);
133+
throw new SourceControlException(SourceControlText.GitNotInit, ex);
134134
}
135135
}
136136

@@ -162,7 +162,7 @@ public override IRepository InitVBAProject(string directory)
162162
}
163163
catch(LibGit2SharpException ex)
164164
{
165-
throw new SourceControlException("Unable to perform intial commit.", ex);
165+
throw new SourceControlException(SourceControlText.GitNoInitialCommit, ex);
166166
}
167167
}
168168

@@ -190,7 +190,7 @@ public override void Push()
190190
}
191191
catch (LibGit2SharpException ex)
192192
{
193-
throw new SourceControlException("Push Failed.", ex);
193+
throw new SourceControlException(SourceControlText.GitPushFailed, ex);
194194
}
195195
}
196196

@@ -218,7 +218,7 @@ public override void Fetch([Optional] string remoteName)
218218
}
219219
catch (LibGit2SharpException ex)
220220
{
221-
throw new SourceControlException("Fetch failed.", ex);
221+
throw new SourceControlException(SourceControlText.GitFetchFailed, ex);
222222
}
223223
}
224224

@@ -243,7 +243,7 @@ public override void Pull()
243243
}
244244
catch (LibGit2SharpException ex)
245245
{
246-
throw new SourceControlException("Pull Failed.", ex);
246+
throw new SourceControlException(SourceControlText.GitPullFailed, ex);
247247
}
248248
}
249249

@@ -258,7 +258,7 @@ public override void Commit(string message)
258258
}
259259
catch (LibGit2SharpException ex)
260260
{
261-
throw new SourceControlException("Commit Failed.", ex);
261+
throw new SourceControlException(SourceControlText.GitCommitFailed, ex);
262262
}
263263
}
264264

@@ -270,7 +270,7 @@ public override void Stage(string filePath)
270270
}
271271
catch (LibGit2SharpException ex)
272272
{
273-
throw new SourceControlException("Failed to stage file.", ex);
273+
throw new SourceControlException(SourceControlText.GitFileStageFailed, ex);
274274
}
275275
}
276276

@@ -282,7 +282,7 @@ public override void Stage(IEnumerable<string> filePaths)
282282
}
283283
catch (LibGit2SharpException ex)
284284
{
285-
throw new SourceControlException("Failed to stage file.", ex);
285+
throw new SourceControlException(SourceControlText.GitFileStageFailed, ex);
286286
}
287287
}
288288

@@ -320,7 +320,7 @@ public override void Checkout(string branch)
320320
}
321321
catch (LibGit2SharpException ex)
322322
{
323-
throw new SourceControlException("Checkout failed.", ex);
323+
throw new SourceControlException(SourceControlText.GitCheckoutFailed, ex);
324324
}
325325
}
326326

@@ -335,7 +335,7 @@ public override void CreateBranch(string branch)
335335
}
336336
catch (LibGit2SharpException ex)
337337
{
338-
throw new SourceControlException("Branch creation failed.", ex);
338+
throw new SourceControlException(SourceControlText.GitNewBranchFailed, ex);
339339
}
340340
}
341341

@@ -350,7 +350,7 @@ public override void CreateBranch(string sourceBranch, string branch)
350350
}
351351
catch (LibGit2SharpException ex)
352352
{
353-
throw new SourceControlException("Branch creation failed.", ex);
353+
throw new SourceControlException(SourceControlText.GitNewBranchFailed, ex);
354354
}
355355
}
356356

@@ -374,7 +374,7 @@ public override void Publish(string branch)
374374
}
375375
catch (LibGit2SharpException ex)
376376
{
377-
throw new SourceControlException("Publish failed.", ex);
377+
throw new SourceControlException(SourceControlText.GitPublishFailed, ex);
378378
}
379379
}
380380

@@ -400,7 +400,7 @@ public override void Unpublish(string branch)
400400
}
401401
catch (LibGit2SharpException ex)
402402
{
403-
throw new SourceControlException("Unpublish failed.", ex);
403+
throw new SourceControlException(SourceControlText.GitUnpublishFailed, ex);
404404
}
405405
}
406406

@@ -412,14 +412,14 @@ public override void Revert()
412412

413413
if (results.Status == RevertStatus.Conflicts)
414414
{
415-
throw new SourceControlException("Revert resulted in conflicts. Revert failed.");
415+
throw new SourceControlException(SourceControlText.GitRevertConflict);
416416
}
417417

418418
base.Revert();
419419
}
420420
catch (LibGit2SharpException ex)
421421
{
422-
throw new SourceControlException("Revert failed.", ex);
422+
throw new SourceControlException(SourceControlText.GitRevertFailed, ex);
423423
}
424424
}
425425

@@ -432,7 +432,7 @@ public override void AddFile(string filePath)
432432
}
433433
catch (LibGit2SharpException ex)
434434
{
435-
throw new SourceControlException(string.Format("Failed to stage file {0}", filePath), ex);
435+
throw new SourceControlException(string.Format(SourceControlText.GitFileStageFailedMsg, filePath), ex);
436436
}
437437
}
438438

@@ -448,7 +448,7 @@ public override void RemoveFile(string filePath)
448448
}
449449
catch (LibGit2SharpException ex)
450450
{
451-
throw new SourceControlException(string.Format("Failed to remove file {0} from staging area.", filePath), ex);
451+
throw new SourceControlException(string.Format(SourceControlText.GitFileStageFailedMsg, filePath), ex);
452452
}
453453
}
454454

@@ -461,7 +461,7 @@ public override IEnumerable<IFileStatusEntry> Status()
461461
}
462462
catch (LibGit2SharpException ex)
463463
{
464-
throw new SourceControlException("Failed to retrieve repository status.", ex);
464+
throw new SourceControlException(SourceControlText.GitRepoStatusFailed, ex);
465465
}
466466
}
467467

@@ -476,7 +476,7 @@ public override void Undo(string filePath)
476476
}
477477
catch (LibGit2SharpException ex)
478478
{
479-
throw new SourceControlException("Undo failed.", ex);
479+
throw new SourceControlException(SourceControlText.GitUndoFailed, ex);
480480
}
481481
}
482482

@@ -507,7 +507,7 @@ public override void DeleteBranch(string branchName)
507507
}
508508
catch(LibGit2SharpException ex)
509509
{
510-
throw new SourceControlException("Branch deletion failed.", ex);
510+
throw new SourceControlException(SourceControlText.GitBranchDeleteFailed, ex);
511511
}
512512
}
513513

Rubberduck.SourceControl/Rubberduck.SourceControl.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
<Compile Include="Repository.cs" />
6969
<Compile Include="SourceControlException.cs" />
7070
<Compile Include="SourceControlProviderBase.cs" />
71+
<Compile Include="SourceControlText.Designer.cs">
72+
<AutoGen>True</AutoGen>
73+
<DesignTime>True</DesignTime>
74+
<DependentUpon>SourceControlText.resx</DependentUpon>
75+
</Compile>
7176
</ItemGroup>
7277
<ItemGroup>
7378
<None Include="packages.config" />
@@ -78,6 +83,14 @@
7883
<Name>Rubberduck.VBEditor</Name>
7984
</ProjectReference>
8085
</ItemGroup>
86+
<ItemGroup>
87+
<EmbeddedResource Include="SourceControlText.de.resx" />
88+
<EmbeddedResource Include="SourceControlText.fr.resx" />
89+
<EmbeddedResource Include="SourceControlText.resx">
90+
<Generator>ResXFileCodeGenerator</Generator>
91+
<LastGenOutput>SourceControlText.Designer.cs</LastGenOutput>
92+
</EmbeddedResource>
93+
</ItemGroup>
8194
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
8295
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
8396
<PropertyGroup>

0 commit comments

Comments
 (0)