From 2d643f20b00f22e251a78b11a01b7aa527d10995 Mon Sep 17 00:00:00 2001 From: Jasmine Date: Thu, 23 Jun 2016 13:09:30 -0400 Subject: [PATCH 1/4] Put all validation messages in Resources for RepositoryCloneViewModel. --- src/GitHub.App/Resources.Designer.cs | 36 +++++++++++++++++++ src/GitHub.App/Resources.resx | 12 +++++++ .../ViewModels/RepositoryCloneViewModel.cs | 8 ++--- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/GitHub.App/Resources.Designer.cs b/src/GitHub.App/Resources.Designer.cs index 8f607e9cfd..b7f73c865b 100644 --- a/src/GitHub.App/Resources.Designer.cs +++ b/src/GitHub.App/Resources.Designer.cs @@ -249,6 +249,33 @@ internal static string RepositoryCloneFailedNoSelectedRepo { } } + /// + /// Looks up a localized string similar to Please enter a valid path. + /// + internal static string RepositoryClonePathInvalid { + get { + return ResourceManager.GetString("RepositoryClonePathInvalid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path contains invalid characters. + /// + internal static string RepositoryClonePathInvalidCharacters { + get { + return ResourceManager.GetString("RepositoryClonePathInvalidCharacters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path too long. + /// + internal static string RepositoryClonePathTooLong { + get { + return ResourceManager.GetString("RepositoryClonePathTooLong", resourceCulture); + } + } + /// /// Looks up a localized string similar to Repository '{0}/{1}' already exists.. /// @@ -276,6 +303,15 @@ internal static string RepositoryCreationFailedQuota { } } + /// + /// Looks up a localized string similar to Please enter a repository path. + /// + internal static string RepositoryCreationPathEmpty { + get { + return ResourceManager.GetString("RepositoryCreationPathEmpty", resourceCulture); + } + } + /// /// Looks up a localized string similar to Repository with same name already exists at this location. /// diff --git a/src/GitHub.App/Resources.resx b/src/GitHub.App/Resources.resx index 0c04c4d88c..91746f056e 100644 --- a/src/GitHub.App/Resources.resx +++ b/src/GitHub.App/Resources.resx @@ -180,6 +180,15 @@ No selected repository. + + Please enter a valid path + + + Path contains invalid characters + + + Path too long + Repository '{0}/{1}' already exists. @@ -189,6 +198,9 @@ Exceeded private repositories quota. + + Please enter a repository path + Repository with same name already exists at this location diff --git a/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs b/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs index 060a017e43..5df66a43f7 100644 --- a/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs +++ b/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs @@ -93,10 +93,10 @@ public RepositoryCloneViewModel( (x, y) => x.Value); BaseRepositoryPathValidator = ReactivePropertyValidator.ForObservable(baseRepositoryPath) - .IfNullOrEmpty("Please enter a repository path") - .IfTrue(x => x.Length > 200, "Path too long") - .IfContainsInvalidPathChars("Path contains invalid characters") - .IfPathNotRooted("Please enter a valid path") + .IfNullOrEmpty(Resources.RepositoryCreationPathEmpty) + .IfTrue(x => x.Length > 200, Resources.RepositoryClonePathTooLong) + .IfContainsInvalidPathChars(Resources.RepositoryClonePathInvalidCharacters) + .IfPathNotRooted(Resources.RepositoryClonePathInvalid) .IfTrue(IsAlreadyRepoAtPath, Resources.RepositoryNameValidatorAlreadyExists); var canCloneObservable = this.WhenAny( From 95b1264def839517c30b1c97c8a961cf13f463d8 Mon Sep 17 00:00:00 2001 From: Jasmine Date: Mon, 27 Jun 2016 13:11:07 +0200 Subject: [PATCH 2/4] Rename repo path validation in resx to share between creation and clone --- src/GitHub.App/Resources.Designer.cs | 30 +++++++++---------- src/GitHub.App/Resources.resx | 12 ++++---- .../ViewModels/RepositoryCloneViewModel.cs | 8 ++--- .../ViewModels/RepositoryCreationViewModel.cs | 8 ++--- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/GitHub.App/Resources.Designer.cs b/src/GitHub.App/Resources.Designer.cs index b7f73c865b..1783516914 100644 --- a/src/GitHub.App/Resources.Designer.cs +++ b/src/GitHub.App/Resources.Designer.cs @@ -249,30 +249,39 @@ internal static string RepositoryCloneFailedNoSelectedRepo { } } + /// + /// Looks up a localized string similar to Please enter a repository path. + /// + internal static string RepositoryCreationClonePathEmpty { + get { + return ResourceManager.GetString("RepositoryCreationClonePathEmpty", resourceCulture); + } + } + /// /// Looks up a localized string similar to Please enter a valid path. /// - internal static string RepositoryClonePathInvalid { + internal static string RepositoryCreationClonePathInvalid { get { - return ResourceManager.GetString("RepositoryClonePathInvalid", resourceCulture); + return ResourceManager.GetString("RepositoryCreationClonePathInvalid", resourceCulture); } } /// /// Looks up a localized string similar to Path contains invalid characters. /// - internal static string RepositoryClonePathInvalidCharacters { + internal static string RepositoryCreationClonePathInvalidCharacters { get { - return ResourceManager.GetString("RepositoryClonePathInvalidCharacters", resourceCulture); + return ResourceManager.GetString("RepositoryCreationClonePathInvalidCharacters", resourceCulture); } } /// /// Looks up a localized string similar to Path too long. /// - internal static string RepositoryClonePathTooLong { + internal static string RepositoryCreationClonePathTooLong { get { - return ResourceManager.GetString("RepositoryClonePathTooLong", resourceCulture); + return ResourceManager.GetString("RepositoryCreationClonePathTooLong", resourceCulture); } } @@ -303,15 +312,6 @@ internal static string RepositoryCreationFailedQuota { } } - /// - /// Looks up a localized string similar to Please enter a repository path. - /// - internal static string RepositoryCreationPathEmpty { - get { - return ResourceManager.GetString("RepositoryCreationPathEmpty", resourceCulture); - } - } - /// /// Looks up a localized string similar to Repository with same name already exists at this location. /// diff --git a/src/GitHub.App/Resources.resx b/src/GitHub.App/Resources.resx index 91746f056e..c130ad65b8 100644 --- a/src/GitHub.App/Resources.resx +++ b/src/GitHub.App/Resources.resx @@ -180,13 +180,16 @@ No selected repository. - + + Please enter a repository path + + Please enter a valid path - + Path contains invalid characters - + Path too long @@ -198,9 +201,6 @@ Exceeded private repositories quota. - - Please enter a repository path - Repository with same name already exists at this location diff --git a/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs b/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs index 5df66a43f7..2be823fce2 100644 --- a/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs +++ b/src/GitHub.App/ViewModels/RepositoryCloneViewModel.cs @@ -93,10 +93,10 @@ public RepositoryCloneViewModel( (x, y) => x.Value); BaseRepositoryPathValidator = ReactivePropertyValidator.ForObservable(baseRepositoryPath) - .IfNullOrEmpty(Resources.RepositoryCreationPathEmpty) - .IfTrue(x => x.Length > 200, Resources.RepositoryClonePathTooLong) - .IfContainsInvalidPathChars(Resources.RepositoryClonePathInvalidCharacters) - .IfPathNotRooted(Resources.RepositoryClonePathInvalid) + .IfNullOrEmpty(Resources.RepositoryCreationClonePathEmpty) + .IfTrue(x => x.Length > 200, Resources.RepositoryCreationClonePathTooLong) + .IfContainsInvalidPathChars(Resources.RepositoryCreationClonePathInvalidCharacters) + .IfPathNotRooted(Resources.RepositoryCreationClonePathInvalid) .IfTrue(IsAlreadyRepoAtPath, Resources.RepositoryNameValidatorAlreadyExists); var canCloneObservable = this.WhenAny( diff --git a/src/GitHub.App/ViewModels/RepositoryCreationViewModel.cs b/src/GitHub.App/ViewModels/RepositoryCreationViewModel.cs index 6cdef22ee4..bf7623581c 100644 --- a/src/GitHub.App/ViewModels/RepositoryCreationViewModel.cs +++ b/src/GitHub.App/ViewModels/RepositoryCreationViewModel.cs @@ -76,10 +76,10 @@ public RepositoryCreationViewModel( browseForDirectoryCommand.Subscribe(_ => ShowBrowseForDirectoryDialog()); BaseRepositoryPathValidator = ReactivePropertyValidator.ForObservable(this.WhenAny(x => x.BaseRepositoryPath, x => x.Value)) - .IfNullOrEmpty("Please enter a repository path") - .IfTrue(x => x.Length > 200, "Path too long") - .IfContainsInvalidPathChars("Path contains invalid characters") - .IfPathNotRooted("Please enter a valid path"); + .IfNullOrEmpty(Resources.RepositoryCreationClonePathEmpty) + .IfTrue(x => x.Length > 200, Resources.RepositoryCreationClonePathTooLong) + .IfContainsInvalidPathChars(Resources.RepositoryCreationClonePathInvalidCharacters) + .IfPathNotRooted(Resources.RepositoryCreationClonePathInvalid); var nonNullRepositoryName = this.WhenAny( x => x.RepositoryName, From 95256e3190b2001362b5fbae7c775ab5b3bcfdd4 Mon Sep 17 00:00:00 2001 From: Jasmine Date: Fri, 1 Jul 2016 13:45:15 +0200 Subject: [PATCH 3/4] move strings in xaml files to resx --- .../Resources.Designer.cs | 36 +++++++++++++++++++ src/GitHub.VisualStudio.UI/Resources.resx | 18 ++++++++-- .../UI/Views/LoggedOutView.xaml | 5 +-- .../UI/Views/NotAGitHubRepositoryView.xaml | 4 +-- 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/GitHub.VisualStudio.UI/Resources.Designer.cs b/src/GitHub.VisualStudio.UI/Resources.Designer.cs index 11d80004ee..9090677f08 100644 --- a/src/GitHub.VisualStudio.UI/Resources.Designer.cs +++ b/src/GitHub.VisualStudio.UI/Resources.Designer.cs @@ -150,6 +150,15 @@ public static string couldNotConnectToTheServerText { } } + /// + /// Looks up a localized string similar to Create an account. + /// + public static string CreateAccountLink { + get { + return ResourceManager.GetString("CreateAccountLink", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create. /// @@ -240,6 +249,15 @@ public static string fileNameText { } } + /// + /// Looks up a localized string similar to Filter branches. + /// + public static string filterBranchesText { + get { + return ResourceManager.GetString("filterBranchesText", resourceCulture); + } + } + /// /// Looks up a localized string similar to Search repositories. /// @@ -267,6 +285,15 @@ public static string GetStartedLink { } } + /// + /// Looks up a localized string similar to Get Started. + /// + public static string GetStartedText { + get { + return ResourceManager.GetString("GetStartedText", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed to create gist. /// @@ -636,6 +663,15 @@ public static string resendCodeButtonToolTip { } } + /// + /// Looks up a localized string similar to Sign In. + /// + public static string SignInLink { + get { + return ResourceManager.GetString("SignInLink", resourceCulture); + } + } + /// /// Looks up a localized string similar to Sign out. /// diff --git a/src/GitHub.VisualStudio.UI/Resources.resx b/src/GitHub.VisualStudio.UI/Resources.resx index 7436edc8c0..24a58dbf56 100644 --- a/src/GitHub.VisualStudio.UI/Resources.resx +++ b/src/GitHub.VisualStudio.UI/Resources.resx @@ -132,9 +132,6 @@ Browse - - Get Started - Could not connect to github.com @@ -330,4 +327,19 @@ We couldn't find a git repository here. Open a git project or click "File -> Add to Source Control" in a project to get started. + + Create an account + + + Filter branches + + + Get Started + + + Get Started + + + Sign In + \ No newline at end of file diff --git a/src/GitHub.VisualStudio/UI/Views/LoggedOutView.xaml b/src/GitHub.VisualStudio/UI/Views/LoggedOutView.xaml index 0339ee18c8..d14f2c482a 100644 --- a/src/GitHub.VisualStudio/UI/Views/LoggedOutView.xaml +++ b/src/GitHub.VisualStudio/UI/Views/LoggedOutView.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:GitHub.VisualStudio.UI.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App" + xmlns:prop="clr-namespace:GitHub.VisualStudio.UI;assembly=GitHub.VisualStudio.UI" xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI" DataContext="{Binding ViewModel}" d:DesignHeight="300" @@ -52,13 +53,13 @@ - Sign in + - Create an account + diff --git a/src/GitHub.VisualStudio/UI/Views/NotAGitHubRepositoryView.xaml b/src/GitHub.VisualStudio/UI/Views/NotAGitHubRepositoryView.xaml index d6fc1a0de9..020a47e9c5 100644 --- a/src/GitHub.VisualStudio/UI/Views/NotAGitHubRepositoryView.xaml +++ b/src/GitHub.VisualStudio/UI/Views/NotAGitHubRepositoryView.xaml @@ -41,8 +41,8 @@ From 81713aa05453f3aded932eb89240f56505503dcc Mon Sep 17 00:00:00 2001 From: Jasmine Date: Mon, 25 Jul 2016 18:31:14 -0400 Subject: [PATCH 4/4] localize pull request creation view messages --- src/GitHub.App/Resources.Designer.cs | 27 +++++++++++++++++++ src/GitHub.App/Resources.resx | 9 +++++++ .../PullRequestCreationViewModel.cs | 7 ++--- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/GitHub.App/Resources.Designer.cs b/src/GitHub.App/Resources.Designer.cs index 1783516914..849f73cdb8 100644 --- a/src/GitHub.App/Resources.Designer.cs +++ b/src/GitHub.App/Resources.Designer.cs @@ -240,6 +240,33 @@ internal static string PublishToTitle { } } + /// + /// Looks up a localized string similar to Please enter a title for the Pull Request. + /// + internal static string PullRequestCreationTitleValidatorEmpty { + get { + return ResourceManager.GetString("PullRequestCreationTitleValidatorEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Source and target branch cannot be the same. + /// + internal static string PullRequestSourceAndTargetBranchTheSame { + get { + return ResourceManager.GetString("PullRequestSourceAndTargetBranchTheSame", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Source branch doesn't exist remotely, have you pushed it?. + /// + internal static string PullRequestSourceBranchDoesNotExist { + get { + return ResourceManager.GetString("PullRequestSourceBranchDoesNotExist", resourceCulture); + } + } + /// /// Looks up a localized string similar to No selected repository.. /// diff --git a/src/GitHub.App/Resources.resx b/src/GitHub.App/Resources.resx index c130ad65b8..fc63e965f8 100644 --- a/src/GitHub.App/Resources.resx +++ b/src/GitHub.App/Resources.resx @@ -177,6 +177,15 @@ Publish repository to {0} + + Please enter a title for the Pull Request + + + Source and target branch cannot be the same + + + Source branch doesn't exist remotely, have you pushed it? + No selected repository. diff --git a/src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs b/src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs index 24f4e9e025..6a2cb6f0e0 100644 --- a/src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs +++ b/src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs @@ -12,6 +12,7 @@ using GitHub.Validation; using GitHub.Extensions; using NullGuard; +using GitHub.App; namespace GitHub.ViewModels { @@ -47,15 +48,15 @@ public PullRequestCreationViewModel(IRepositoryHost repositoryHost, ISimpleRepos var titleObs = this.WhenAny(x => x.PRTitle, x => x.Value); TitleValidator = ReactivePropertyValidator.ForObservable(titleObs) - .IfNullOrEmpty("Please enter a title for the Pull Request"); + .IfNullOrEmpty(Resources.PullRequestCreationTitleValidatorEmpty); var branchObs = this.WhenAny( x => x.SourceBranch, source => source.Value); BranchValidator = ReactivePropertyValidator.ForObservable(branchObs) - .IfTrue(x => x == null, "Source branch doesn't exist remotely, have you pushed it?") - .IfTrue(x => x.Name == TargetBranch.Name, "Source and target branch cannot be the same"); + .IfTrue(x => x == null, Resources.PullRequestSourceBranchDoesNotExist) + .IfTrue(x => x.Name == TargetBranch.Name, Resources.PullRequestSourceAndTargetBranchTheSame); var whenAnyValidationResultChanges = this.WhenAny( x => x.TitleValidator.ValidationResult,