提交 6d4f58bf 编写于 作者: A Andrew Hall (METAL)

Move strings to resource file

上级 76833ddb
......@@ -111,6 +111,7 @@ public static class Features
public const string CodeActionsMergeConsecutiveIfStatements = "CodeActions.MergeConsecutiveIfStatements";
public const string CodeActionsMergeNestedIfStatements = "CodeActions.MergeNestedIfStatements";
public const string CodeActionsMoveDeclarationNearReference = "CodeActions.MoveDeclarationNearReference";
public const string CodeActionsMoveToNamespace = nameof(CodeActionsMoveToNamespace);
public const string CodeActionsMoveToTopOfFile = "CodeActions.MoveToTopOfFile";
public const string CodeActionsMoveType = "CodeActions.MoveType";
public const string CodeActionsOrderModifiers = "CodeActions.OrderModifiers";
......
......@@ -2,10 +2,8 @@
using System.Collections.Immutable;
using Microsoft.VisualStudio.Imaging.Interop;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
using Microsoft.VisualStudio.Imaging;
using Microsoft.CodeAnalysis.MoveToNamespace;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.MoveToNamespace
......@@ -19,7 +17,7 @@ class MoveToNamespaceDialogViewModel : AbstractNotifyPropertyChanged
NamespaceName = defaultNamespace;
AvailableNamespaces = availableNamespaces;
this.PropertyChanged += MoveToNamespaceDialogViewModel_PropertyChanged;
PropertyChanged += MoveToNamespaceDialogViewModel_PropertyChanged;
}
private void MoveToNamespaceDialogViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
......@@ -40,14 +38,14 @@ public void OnNamespaceUpdated()
if (isNewNamespace && isValidName)
{
Icon = KnownMonikers.StatusInformation;
Message = $"'{NamespaceName}' will be created as a new namespace";
Message = string.Format(ServicesVSResources._0_will_be_created_as_a_new_namespace, NamespaceName);
ShowMessage = true;
CanSubmit = true;
}
else if (!isValidName)
{
Icon = KnownMonikers.StatusInvalid;
Message = $"'{NamespaceName}' is not a valid namespace";
Message = string.Format(ServicesVSResources._0_is_an_invalid_namespace, NamespaceName);
ShowMessage = true;
CanSubmit = false;
}
......
......@@ -69,6 +69,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos; is an invalid namespace.
/// </summary>
internal static string _0_is_an_invalid_namespace {
get {
return ResourceManager.GetString("_0_is_an_invalid_namespace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} references.
/// </summary>
......@@ -116,6 +125,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos; will be created as a new namespace.
/// </summary>
internal static string _0_will_be_created_as_a_new_namespace {
get {
return ResourceManager.GetString("_0_will_be_created_as_a_new_namespace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1 reference.
/// </summary>
......
......@@ -1210,4 +1210,10 @@ I agree to all of the foregoing:</value>
<data name="Target_Namespace_colon" xml:space="preserve">
<value>Target Namespace:</value>
</data>
<data name="_0_is_an_invalid_namespace" xml:space="preserve">
<value>'{0}' is an invalid namespace</value>
</data>
<data name="_0_will_be_created_as_a_new_namespace" xml:space="preserve">
<value>'{0}' will be created as a new namespace</value>
</data>
</root>
\ No newline at end of file
......@@ -432,6 +432,11 @@
<target state="translated">Není platnou hodnotou.</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">{0} se změní na abstraktní.</target>
......@@ -447,6 +452,11 @@
<target state="translated">{0} se změní na veřejný.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">Daný pracovní prostor nepodporuje vrácení akce zpátky.</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">Kein gültiger Wert.</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">"{0}" wird in abstrakten Wert geändert.</target>
......@@ -447,6 +452,11 @@
<target state="translated">"{0}" wird in öffentlichen Wert geändert.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">Der angegebene Arbeitsbereich unterstützt die Funktion "Rückgängig" nicht.</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">No es un valor válido</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">"{0}" se cambiará a abstracto.</target>
......@@ -447,6 +452,11 @@
<target state="translated">"{0}" se cambiará a público.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">el área de trabajo determinada no permite deshacer</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">Valeur non valide</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}' va être changé en valeur abstraite.</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}' va être changé en valeur publique.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">l'espace de travail donné ne prend pas en charge la fonction Annuler</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">Valore non valido</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}' verrà modificato in astratto.</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}' verrà modificato in pubblico.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">l'area di lavoro specificata non supporta l'annullamento di operazioni</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">有効な値ではありません</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}' は抽象に変更されます。</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}' はパブリックに変更されます。</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">指定されたワークスペースは元に戻す操作をサポートしていません</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">값이 잘못되었습니다.</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}'이(가) 추상으로 변경됩니다.</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}'이(가) 공용으로 변경됩니다.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">지정한 작업 영역에서 실행을 취소할 수 없습니다.</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">Nieprawidłowa wartość</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">Element „{0}” zostanie zmieniony na abstrakcyjny.</target>
......@@ -447,6 +452,11 @@
<target state="translated">Element „{0}” zostanie zmieniony na publiczny.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">dany obszar roboczy nie obsługuje operacji cofania</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">O valor não é válido</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}' será alterado para abstrato.</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}' será alterado para público.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">o workspace fornecido não dá suporte a desfazer</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">Недопустимое значение</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">Элемент "{0}" будет изменен на абстрактный.</target>
......@@ -447,6 +452,11 @@
<target state="translated">Элемент "{0}" будет изменен на открытый.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">заданная рабочая область не поддерживает отмену.</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">Geçerli bir değer değil</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}' soyut olacak şekilde değiştirildi.</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}' ortak olacak şekilde değiştirildi.</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">sağlanan çalışma alanı, geri almayı desteklemiyor</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">值无效</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">“{0}”将更改为“抽象”。</target>
......@@ -447,6 +452,11 @@
<target state="translated">“{0}”将更改为“公共”。</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">给定的工作区不支持撤消</target>
......
......@@ -432,6 +432,11 @@
<target state="translated">值無效</target>
<note />
</trans-unit>
<trans-unit id="_0_is_an_invalid_namespace">
<source>'{0}' is an invalid namespace</source>
<target state="new">'{0}' is an invalid namespace</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_changed_to_abstract">
<source>'{0}' will be changed to abstract.</source>
<target state="translated">'{0}' 會變更為抽象。</target>
......@@ -447,6 +452,11 @@
<target state="translated">'{0}' 會變更為公用。</target>
<note />
</trans-unit>
<trans-unit id="_0_will_be_created_as_a_new_namespace">
<source>'{0}' will be created as a new namespace</source>
<target state="new">'{0}' will be created as a new namespace</target>
<note />
</trans-unit>
<trans-unit id="given_workspace_doesn_t_support_undo">
<source>given workspace doesn't support undo</source>
<target state="translated">指定的工作區不支援復原</target>
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.VisualStudio.Imaging
Imports Microsoft.VisualStudio.LanguageServices.Implementation.MoveToNamespace
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.MoveToNamespace
<[UseExportProvider]>
Public Class MoveToNamespaceDialogViewModelTests
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveToNamespace)>
Public Sub TestMoveToNamespace_ErrorState()
Dim viewModel = CreateViewModel()
Assert.True(viewModel.CanSubmit)
Assert.False(viewModel.ShowMessage)
viewModel.NamespaceName = "2InvalidNamespace"
Assert.False(viewModel.CanSubmit)
Assert.True(viewModel.ShowMessage)
Assert.Equal(viewModel.Icon, KnownMonikers.StatusInvalid)
viewModel.NamespaceName = viewModel.AvailableNamespaces.First()
Assert.True(viewModel.CanSubmit)
Assert.False(viewModel.ShowMessage)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveToNamespace)>
Public Sub TestMoveToNamespace_NewNamespaceState()
Dim viewModel = CreateViewModel()
Assert.True(viewModel.CanSubmit)
Assert.False(viewModel.ShowMessage)
viewModel.NamespaceName = viewModel.AvailableNamespaces.Last() & ".NewNamespace"
Assert.True(viewModel.CanSubmit)
Assert.True(viewModel.ShowMessage)
Assert.Equal(viewModel.Icon, KnownMonikers.StatusInformation)
viewModel.NamespaceName = viewModel.AvailableNamespaces.First()
Assert.True(viewModel.CanSubmit)
Assert.False(viewModel.ShowMessage)
End Sub
Private Function CreateViewModel(Optional defaultNamespace As String = Nothing, Optional availableNamespaces As ImmutableArray(Of String) = Nothing) As MoveToNamespaceDialogViewModel
If (defaultNamespace Is Nothing) Then
defaultNamespace = "Default.Namespace"
End If
If (availableNamespaces = Nothing) Then
availableNamespaces = ImmutableArray.Create({
defaultNamespace,
defaultNamespace & "1",
defaultNamespace & "2"})
End If
Return New MoveToNamespaceDialogViewModel(defaultNamespace, availableNamespaces)
End Function
End Class
End Namespace
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册