提交 69e9c10b 编写于 作者: B Balaji Krishnan

Localize strings.

上级 77319f1a
......@@ -105,6 +105,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Do not prefer &apos;this.&apos;.
/// </summary>
internal static string DoNotPreferThis {
get {
return ResourceManager.GetString("DoNotPreferThis", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Place &quot;else&quot; on new line.
/// </summary>
......@@ -618,6 +627,33 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to predefined type preferences:.
/// </summary>
internal static string PredefinedTypesGroupTitle {
get {
return ResourceManager.GetString("PredefinedTypesGroupTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Prefer explicit type.
/// </summary>
internal static string PreferExplicitType {
get {
return ResourceManager.GetString("PreferExplicitType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Prefer framework type.
/// </summary>
internal static string PreferFrameworkType {
get {
return ResourceManager.GetString("PreferFrameworkType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to For locals, parameters and members.
/// </summary>
......@@ -636,6 +672,33 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Prefer predefined type.
/// </summary>
internal static string PreferPredefinedType {
get {
return ResourceManager.GetString("PreferPredefinedType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Prefer &apos;this.&apos;.
/// </summary>
internal static string PreferThis {
get {
return ResourceManager.GetString("PreferThis", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Prefer &apos;var&apos;.
/// </summary>
internal static string PreferVar {
get {
return ResourceManager.GetString("PreferVar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Qualify event access with &apos;this&apos;.
/// </summary>
......@@ -654,6 +717,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to &apos;this.&apos; preferences:.
/// </summary>
internal static string QualifyGroupTitle {
get {
return ResourceManager.GetString("QualifyGroupTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Qualify method access with &apos;this&apos;.
/// </summary>
......@@ -987,6 +1059,15 @@ internal class CSharpVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to &apos;var&apos; preferences:.
/// </summary>
internal static string VarGroupTitle {
get {
return ResourceManager.GetString("VarGroupTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Leave statements and member declarations on the same line.
/// </summary>
......
......@@ -432,4 +432,31 @@
<data name="QualifyPropertyAccessWithThis" xml:space="preserve">
<value>Qualify property access with 'this'</value>
</data>
<data name="PreferExplicitType" xml:space="preserve">
<value>Prefer explicit type</value>
</data>
<data name="PreferFrameworkType" xml:space="preserve">
<value>Prefer framework type</value>
</data>
<data name="PreferPredefinedType" xml:space="preserve">
<value>Prefer predefined type</value>
</data>
<data name="PreferThis" xml:space="preserve">
<value>Prefer 'this.'</value>
</data>
<data name="PreferVar" xml:space="preserve">
<value>Prefer 'var'</value>
</data>
<data name="QualifyGroupTitle" xml:space="preserve">
<value>'this.' preferences:</value>
</data>
<data name="VarGroupTitle" xml:space="preserve">
<value>'var' preferences:</value>
</data>
<data name="DoNotPreferThis" xml:space="preserve">
<value>Do not prefer 'this.'</value>
</data>
<data name="PredefinedTypesGroupTitle" xml:space="preserve">
<value>predefined type preferences:</value>
</data>
</root>
\ No newline at end of file
......@@ -170,31 +170,29 @@ internal StyleViewModel(OptionSet optionSet, IServiceProvider serviceProvider) :
{
CodeStyleItems = new ObservableCollection<AbstractCodeStyleOptionViewModel>();
ListCollectionView collectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(CodeStyleItems);
var collectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(CodeStyleItems);
collectionView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AbstractCodeStyleOptionViewModel.GroupName)));
// TODO: move all strings from here to resx for loc.
const string qualifyGroupTitle = "this. preferences:";
const string predefinedTypesGroupTitle = "predefined type preferences:";
const string varGroupTitle = "'var' preferences:";
var qualifyGroupTitle = CSharpVSResources.QualifyGroupTitle;
var predefinedTypesGroupTitle = CSharpVSResources.PredefinedTypesGroupTitle;
var varGroupTitle = CSharpVSResources.VarGroupTitle;
var qualifyMemberAccessPreferences = new List<CodeStylePreference>
{
new CodeStylePreference("Prefer this.", true),
new CodeStylePreference("Do not prefer this.", false),
new CodeStylePreference(CSharpVSResources.PreferThis, isChecked: true),
new CodeStylePreference(CSharpVSResources.DoNotPreferThis, isChecked: false),
};
var predefinedTypesPreferences = new List<CodeStylePreference>
{
new CodeStylePreference("Prefer predefined type", true),
new CodeStylePreference("Prefer framework type", false),
new CodeStylePreference(CSharpVSResources.PreferPredefinedType, isChecked: true),
new CodeStylePreference(CSharpVSResources.PreferFrameworkType, isChecked: false),
};
var useVarPreferences = new List<CodeStylePreference>
{
new CodeStylePreference("Prefer 'var'", true),
new CodeStylePreference("Prefer explicit type", false),
new CodeStylePreference(CSharpVSResources.PreferVar, isChecked: true),
new CodeStylePreference(CSharpVSResources.PreferExplicitType, isChecked: false),
};
CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(SimplificationOptions.QualifyMemberAccessWithThisOrMe, CSharpVSResources.QualifyMemberAccessWithThis, s_declarationPreviewTrue, s_declarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
......
......@@ -764,6 +764,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to No.
/// </summary>
internal static string No {
get {
return ResourceManager.GetString("No", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No Changes.
/// </summary>
......@@ -1227,6 +1236,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Yes.
/// </summary>
internal static string Yes {
get {
return ResourceManager.GetString("Yes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You must select at least one member..
/// </summary>
......
......@@ -513,4 +513,10 @@ Use the dropdown to view and switch to other projects this file may belong to.</
<data name="Unknown" xml:space="preserve">
<value>&lt;Unknown&gt;</value>
</data>
<data name="No" xml:space="preserve">
<value>No</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
</root>
\ No newline at end of file
......@@ -37,7 +37,7 @@ internal abstract class AbstractCodeStyleOptionViewModel : AbstractNotifyPropert
public List<NotificationOptionViewModel> NotificationPreferences { get; set; }
public abstract bool NotificationsAvailable { get; }
public virtual string GetPreview() => SelectedPreference.IsChecked? _truePreview : _falsePreview;
public virtual string GetPreview() => SelectedPreference.IsChecked ? _truePreview : _falsePreview;
public AbstractCodeStyleOptionViewModel(
IOption option,
......@@ -77,9 +77,8 @@ private static List<CodeStylePreference> GetDefaultPreferences()
{
return new List<CodeStylePreference>
{
// TODO: move to resx for loc.
new CodeStylePreference("Yes", true),
new CodeStylePreference("No", false),
new CodeStylePreference(ServicesVSResources.Yes, isChecked: true),
new CodeStylePreference(ServicesVSResources.No, isChecked: false),
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册