Permalink
Browse files

implement localization of SearchPanel in SharpDevelop

  • Loading branch information...
1 parent beb5899 commit 40ae341392913ebd7075419f5f25b11e1eb860eb @siegfriedpammer siegfriedpammer committed Oct 26, 2011
@@ -229,6 +229,18 @@ Laden Sie ein AddIn aus dem Internet herunter, klicken Sie auf "AddIn installier
<data name="AddInManager.UnknownFileFormat" xml:space="preserve">
<value>Unbekanntes Dateiformat:</value>
</data>
+ <data name="AddIns.AvalonEdit.SearchPanel.ErrorText" xml:space="preserve">
+ <value>Fehler:</value>
+ </data>
+ <data name="AddIns.AvalonEdit.SearchPanel.FindNextText" xml:space="preserve">
+ <value>Weiter</value>
+ </data>
+ <data name="AddIns.AvalonEdit.SearchPanel.FindPreviousText" xml:space="preserve">
+ <value>Zurück</value>
+ </data>
+ <data name="AddIns.AvalonEdit.SearchPanel.UseRegexText" xml:space="preserve">
+ <value>Reguläre Ausdrücke verwenden</value>
+ </data>
<data name="AddIns.ClassDiagram.ShowClassDiagram" xml:space="preserve">
<value>Klassendiagramm anzeigen</value>
</data>
@@ -655,7 +667,7 @@ Optional können Sie auch ein Arbeitsverzeichnis und Kommandozeilen-Argumente an
<value>Mit Profiler starten</value>
</data>
<data name="AddIns.SearchReplace.SearchProgressTitle" xml:space="preserve">
- <value>Suchen...</value>
+ <value>Suchen ...</value>
</data>
<data name="AddIns.SharpRefactoring.ExtractMethod" xml:space="preserve">
<value>Methode extrahieren</value>
@@ -229,6 +229,19 @@ Download an AddIn from the Internet, then click 'Install AddIn' and choose the d
<data name="AddInManager.UnknownFileFormat" xml:space="preserve">
<value>Unknown file format:</value>
</data>
+ <data name="AddIns.AvalonEdit.SearchPanel.ErrorText" xml:space="preserve">
+ <value>Error:</value>
+ <comment>Note: Mind the trailing space!</comment>
+ </data>
+ <data name="AddIns.AvalonEdit.SearchPanel.FindNextText" xml:space="preserve">
+ <value>Find next</value>
+ </data>
+ <data name="AddIns.AvalonEdit.SearchPanel.FindPreviousText" xml:space="preserve">
+ <value>Find previous</value>
+ </data>
+ <data name="AddIns.AvalonEdit.SearchPanel.UseRegexText" xml:space="preserve">
+ <value>Use regular expressions</value>
+ </data>
<data name="AddIns.ClassDiagram.ShowClassDiagram" xml:space="preserve">
<value>Show Class Diagram</value>
</data>
@@ -6550,9 +6563,6 @@ Removed the end part of the original message ", reason '${Message}'" since this
<data name="ProjectComponent.ContextMenu.ViewInBrowser" xml:space="preserve">
<value>View in browser</value>
</data>
- <data name="ProjectComponent.ContextMenu.NotAWebProject" xml:space="preserve">
- <value>The project is not a web project.</value>
- </data>
<data name="ProjectComponent.NewFolderString" xml:space="preserve">
<value>New Folder</value>
</data>
@@ -116,6 +116,7 @@
<Compile Include="Src\MyersDiff\StringSequence.cs" />
<Compile Include="Src\MyersDiff\Utils.cs" />
<Compile Include="Src\NewLineConsistencyCheck.cs" />
+ <Compile Include="Src\SearchPanelLocalization.cs" />
<Compile Include="Src\SharpDevelopTextEditor.cs" />
<Compile Include="Src\Commands\FoldingCommands.cs" />
<Compile Include="Src\Commands\SaveFileWithEncoding.cs" />
@@ -0,0 +1,71 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
+
+using System;
+using System.ComponentModel;
+using ICSharpCode.AvalonEdit.Search;
+using ICSharpCode.Core;
+using ICSharpCode.Core.Presentation;
+
+namespace ICSharpCode.AvalonEdit.AddIn
+{
+ public class SearchPanelLocalization : Localization, INotifyPropertyChanged
+ {
+ static SearchPanelLocalization instance;
+
+ public static SearchPanelLocalization Instance {
+ get {
+ if (instance == null)
+ instance = new SearchPanelLocalization();
+ return instance;
+ }
+ }
+
+ public SearchPanelLocalization()
+ {
+ ResourceService.LanguageChanged += delegate { PropertiesChanged(); };
+ }
+
+ public override string ErrorText {
+ get { return StringParser.Parse("${res:AddIns.AvalonEdit.SearchPanel.ErrorText}"); }
+ }
+
+ public override string FindNextText {
+ get { return StringParser.Parse("${res:AddIns.AvalonEdit.SearchPanel.FindNextText}") + " (F3)"; }
+ }
+
+ public override string FindPreviousText {
+ get { return StringParser.Parse("${res:AddIns.AvalonEdit.SearchPanel.FindPreviousText}") + " (Shift+F3)"; }
+ }
+
+ public override string MatchCaseText {
+ get { return MenuService.ConvertLabel(StringParser.Parse("${res:Dialog.NewProject.SearchReplace.MatchCase}")); }
+ }
+
+ public override string MatchWholeWordsText {
+ get { return MenuService.ConvertLabel(StringParser.Parse("${res:Dialog.NewProject.SearchReplace.MatchWholeWord}")); }
+ }
+
+ public override string NoMatchesFoundText {
+ get { return StringParser.Parse("${res:Dialog.NewProject.SearchReplace.SearchStringNotFound}"); }
+ }
+
+ public override string UseRegexText {
+ get { return StringParser.Parse("${res:AddIns.AvalonEdit.SearchPanel.UseRegexText}"); }
+ }
+
+ public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged(string propertyName)
+ {
+ if (PropertyChanged != null) {
+ PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ void PropertiesChanged()
+ {
+ OnPropertyChanged(null);
+ }
+ }
+}
@@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ae="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
@@ -24,7 +25,13 @@
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
- TextOptions.TextFormattingMode="{Binding CurrentZoom, ElementName=PART_ScrollViewer, Converter={x:Static local:ZoomLevelToTextFormattingModeConverter.Instance}}" />
+ TextOptions.TextFormattingMode="{Binding CurrentZoom, ElementName=PART_ScrollViewer, Converter={x:Static local:ZoomLevelToTextFormattingModeConverter.Instance}}">
+ <widgets:ZoomScrollViewer.Resources>
+ <Style TargetType="{x:Type ae:SearchPanel}">
+ <Setter Property="Localization" Value="{x:Static local:SearchPanelLocalization.Instance}" />
+ </Style>
+ </widgets:ZoomScrollViewer.Resources>
+ </widgets:ZoomScrollViewer>
<ControlTemplate.Triggers>
<Trigger Property="WordWrap"
Value="True">
@@ -22,7 +22,6 @@ namespace SearchAndReplace
public class SearchAndReplacePanel : BaseSharpDevelopUserControl
{
SearchAndReplaceMode searchAndReplaceMode;
- ITextEditor textEditor;
public SearchAndReplaceMode SearchAndReplaceMode {
get {
@@ -41,3 +41,4 @@
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Editing")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Rendering")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Highlighting")]
+[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Search")]
@@ -4,7 +4,7 @@
using System;
using System.ComponentModel;
-namespace ICSharpCode.AvalonEdit
+namespace ICSharpCode.AvalonEdit.Search
{
/// <summary>
/// Holds default texts for buttons and labels in the SearchPanel. Override properties to add other languages.
@@ -35,7 +35,6 @@ public class Localization
/// <summary>
/// Default: 'Find next (F3)'
- ///
/// </summary>
public virtual string FindNextText {
get { return "Find next (F3)"; }
@@ -269,7 +269,7 @@ public void FindPrevious()
}
}
- ToolTip messageView = new ToolTip { Placement = PlacementMode.Bottom };
+ ToolTip messageView = new ToolTip { Placement = PlacementMode.Bottom, StaysOpen = false };
void DoSearch(bool changeSelection)
{
@@ -327,7 +327,7 @@ void SearchLayerKeyDown(object sender, KeyEventArgs e)
if (searchTextBox != null) {
var error = Validation.GetErrors(searchTextBox).FirstOrDefault();
if (error != null) {
- messageView.Content = Localization.ErrorText + error.ErrorContent;
+ messageView.Content = Localization.ErrorText + " " + error.ErrorContent;
messageView.PlacementTarget = searchTextBox;
messageView.IsOpen = true;
}

0 comments on commit 40ae341

Please sign in to comment.