Skip to content

Commit

Permalink
Add more localized strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Jan 21, 2020
1 parent a64e593 commit 9e5fda9
Show file tree
Hide file tree
Showing 38 changed files with 1,894 additions and 25 deletions.
9 changes: 9 additions & 0 deletions ModernWpf.Controls/CommandBar/CommandBarToolBar.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
Expand Down Expand Up @@ -206,10 +207,17 @@ public override void OnApplyTemplate()
}

m_layoutRoot = this.GetTemplateRoot();
m_moreButton = GetTemplateChild("MoreButton") as ButtonBase;
m_overflowPopup = GetTemplateChild(OverflowPopupName) as Popup;
m_toolBarPanel = GetTemplateChild(ToolBarPanelName) as ToolBarPanel;
m_toolBarOverflowPanel = GetTemplateChild(ToolBarOverflowPanelName) as CommandBarOverflowPanel;

if (m_moreButton != null)
{
AutomationProperties.SetName(m_moreButton, Strings.AppBarMoreButtonName);
m_moreButton.ToolTip = Strings.AppBarMoreButtonToolTip;
}

if (m_overflowPopup != null)
{
m_overflowPopup.CustomPopupPlacementCallback = PositionOverflowPopup;
Expand Down Expand Up @@ -324,6 +332,7 @@ private CustomPopupPlacement[] PositionOverflowPopup(Size popupSize, Size target
}

private FrameworkElement m_layoutRoot;
private ButtonBase m_moreButton;
private Popup m_overflowPopup;
private ToolBarPanel m_toolBarPanel;
private CommandBarOverflowPanel m_toolBarOverflowPanel;
Expand Down
4 changes: 2 additions & 2 deletions ModernWpf.Controls/NumberBox/NumberBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ public override void OnApplyTemplate()
{
base.OnApplyTemplate();

var spinDownName = "Decrease";
var spinUpName = "Increase";
var spinDownName = Strings.NumberBoxDownSpinButtonName;
var spinUpName = Strings.NumberBoxUpSpinButtonName;

if (GetTemplateChild(c_numberBoxDownButtonName) is RepeatButton spinDown)
{
Expand Down
2 changes: 1 addition & 1 deletion ModernWpf.Controls/SplitButton/SplitButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public override void OnApplyTemplate()

if (m_secondaryButton != null)
{
var secondaryName = "More Options";
var secondaryName = Strings.SplitButtonSecondaryButtonName;
AutomationProperties.SetName(m_secondaryButton, secondaryName);

m_secondaryButton.Click += OnClickSecondary;
Expand Down
47 changes: 47 additions & 0 deletions ModernWpf.MahApps/HamburgerMenu/HamburgerMenuEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using ModernWpf.Controls;
using System;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
Expand All @@ -19,6 +20,7 @@ public class HamburgerMenuEx : HamburgerMenu
{
private const string c_searchButtonName = "PaneAutoSuggestButton";
private const string c_navViewBackButton = "NavigationViewBackButton";
private const string c_navViewBackButtonToolTip = "NavigationViewBackButtonToolTip";

private static readonly Point c_frame1point1 = new Point(0.9, 0.1);
private static readonly Point c_frame1point2 = new Point(1.0, 0.2);
Expand All @@ -28,6 +30,7 @@ public class HamburgerMenuEx : HamburgerMenu
private UIElement _paneGrid;
private Button _paneSearchButton;
private Button _backButton;
private Button _paneToggleButton;
private ListBox _buttonsListView;
private ListBox _optionsListView;

Expand Down Expand Up @@ -428,17 +431,37 @@ public override void OnApplyTemplate()
_paneGrid = GetTemplateChild("PaneGrid") as UIElement;
_paneSearchButton = GetTemplateChild(c_searchButtonName) as Button;
_backButton = GetTemplateChild(c_navViewBackButton) as Button;
_paneToggleButton = GetTemplateChild("HamburgerButton") as Button;
_buttonsListView = GetTemplateChild("ButtonsListView") as ListBox;
_optionsListView = GetTemplateChild("OptionsListView") as ListBox;

if (_paneToggleButton != null)
{
SetPaneToggleButtonAutomationName();
}

if (_paneSearchButton != null)
{
_paneSearchButton.Click += OnPaneSearchButtonClick;

var searchButtonName = Strings.NavigationViewSearchButtonName;
AutomationProperties.SetName(_paneSearchButton, searchButtonName);
var toolTip = new ToolTip
{
Content = searchButtonName
};
ToolTipService.SetToolTip(_paneSearchButton, toolTip);
}

if (_backButton != null)
{
_backButton.Click += OnBackButtonClicked;
AutomationProperties.SetName(_backButton, Strings.NavigationBackButtonName);
}

if (GetTemplateChild(c_navViewBackButtonToolTip) is ToolTip backButtonToolTip)
{
backButtonToolTip.Content = Strings.NavigationBackButtonToolTip;
}

if (_buttonsListView != null && _optionsListView != null)
Expand Down Expand Up @@ -505,6 +528,7 @@ private void OnDisplayModeChanged(DependencyPropertyChangedEventArgs e)

private void OnIsPaneOpenChanged(DependencyPropertyChangedEventArgs e)
{
SetPaneToggleButtonAutomationName();
UpdatePaneLength();
ChangeItemFocusVisualStyle();

Expand Down Expand Up @@ -537,6 +561,29 @@ private void ChangeItemFocusVisualStyle()
}
}

private void SetPaneToggleButtonAutomationName()
{
string navigationName;
if (IsPaneOpen)
{
navigationName = Strings.NavigationButtonOpenName;
}
else
{
navigationName = Strings.NavigationButtonClosedName;
}

if (_paneToggleButton != null)
{
AutomationProperties.SetName(_paneToggleButton, navigationName);
var toolTip = new ToolTip
{
Content = navigationName
};
ToolTipService.SetToolTip(_paneToggleButton, toolTip);
}
}

private void AnimateSelectionChanged(object prevItem, object nextItem)
{
UIElement prevIndicator = FindSelectionIndicator(prevItem);
Expand Down
90 changes: 90 additions & 0 deletions ModernWpf.MahApps/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions ModernWpf.MahApps/Resources/Strings.cs.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,44 @@
<data name="TimePickerSecond" xml:space="preserve">
<value>sekundu</value>
</data>
<data name="NavigationBackButtonName" xml:space="preserve">
<value>Zpět</value>
<comment>Automation name for the nav view provided back button</comment>
</data>
<data name="NavigationBackButtonToolTip" xml:space="preserve">
<value>Zpět</value>
<comment>ToolTip caption for the back button</comment>
</data>
<data name="NavigationButtonClosedName" xml:space="preserve">
<value>Otevřít navigaci</value>
<comment>Automation name for the hamburger button when it is in a closed state</comment>
</data>
<data name="NavigationButtonOpenName" xml:space="preserve">
<value>Zavřít navigaci</value>
<comment>Automation name and tooltip caption for the hamburger button when it is in an open state, and tooltip caption for the close button</comment>
</data>
<data name="NavigationCloseButtonName" xml:space="preserve">
<value>Zavřít</value>
<comment>Automation name for the nav view provided close button</comment>
</data>
<data name="NavigationOverflowButtonName" xml:space="preserve">
<value>Tlačítko Více</value>
<comment>Automation name for the nav view more button when panel is on top</comment>
</data>
<data name="NavigationOverflowButtonText" xml:space="preserve">
<value>Více</value>
<comment>Text for the nav view more button when panel is on top</comment>
</data>
<data name="NavigationViewItemDefaultControlName" xml:space="preserve">
<value>PoložkaProZobrazeníNavigace</value>
<comment>Default automation id if no name or id is provided</comment>
</data>
<data name="NavigationViewSearchButtonName" xml:space="preserve">
<value>Kliknutím spustit vyhledávání</value>
<comment>Name for the compact view search button</comment>
</data>
<data name="SettingsButtonName" xml:space="preserve">
<value>Nastavení</value>
<comment>Automation name for the settings button</comment>
</data>
</root>
40 changes: 40 additions & 0 deletions ModernWpf.MahApps/Resources/Strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,44 @@
<data name="TimePickerSecond" xml:space="preserve">
<value>Sekunde</value>
</data>
<data name="NavigationBackButtonName" xml:space="preserve">
<value>Zurück</value>
<comment>Automation name for the nav view provided back button</comment>
</data>
<data name="NavigationBackButtonToolTip" xml:space="preserve">
<value>Zurück</value>
<comment>ToolTip caption for the back button</comment>
</data>
<data name="NavigationButtonClosedName" xml:space="preserve">
<value>Navigation öffnen</value>
<comment>Automation name for the hamburger button when it is in a closed state</comment>
</data>
<data name="NavigationButtonOpenName" xml:space="preserve">
<value>Navigation schließen</value>
<comment>Automation name and tooltip caption for the hamburger button when it is in an open state, and tooltip caption for the close button</comment>
</data>
<data name="NavigationCloseButtonName" xml:space="preserve">
<value>Schließen</value>
<comment>Automation name for the nav view provided close button</comment>
</data>
<data name="NavigationOverflowButtonName" xml:space="preserve">
<value>Schaltfläche „Mehr“</value>
<comment>Automation name for the nav view more button when panel is on top</comment>
</data>
<data name="NavigationOverflowButtonText" xml:space="preserve">
<value>Mehr</value>
<comment>Text for the nav view more button when panel is on top</comment>
</data>
<data name="NavigationViewItemDefaultControlName" xml:space="preserve">
<value>NavigationViewItem</value>
<comment>Default automation id if no name or id is provided</comment>
</data>
<data name="NavigationViewSearchButtonName" xml:space="preserve">
<value>Klicken, um zu suchen</value>
<comment>Name for the compact view search button</comment>
</data>
<data name="SettingsButtonName" xml:space="preserve">
<value>Einstellungen</value>
<comment>Automation name for the settings button</comment>
</data>
</root>
40 changes: 40 additions & 0 deletions ModernWpf.MahApps/Resources/Strings.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,44 @@
<data name="TimePickerSecond" xml:space="preserve">
<value>segundo</value>
</data>
<data name="NavigationBackButtonName" xml:space="preserve">
<value>Atrás</value>
<comment>Automation name for the nav view provided back button</comment>
</data>
<data name="NavigationBackButtonToolTip" xml:space="preserve">
<value>Atrás</value>
<comment>ToolTip caption for the back button</comment>
</data>
<data name="NavigationButtonClosedName" xml:space="preserve">
<value>Abrir navegación</value>
<comment>Automation name for the hamburger button when it is in a closed state</comment>
</data>
<data name="NavigationButtonOpenName" xml:space="preserve">
<value>Cerrar navegación</value>
<comment>Automation name and tooltip caption for the hamburger button when it is in an open state, and tooltip caption for the close button</comment>
</data>
<data name="NavigationCloseButtonName" xml:space="preserve">
<value>Cerrar</value>
<comment>Automation name for the nav view provided close button</comment>
</data>
<data name="NavigationOverflowButtonName" xml:space="preserve">
<value>Botón más</value>
<comment>Automation name for the nav view more button when panel is on top</comment>
</data>
<data name="NavigationOverflowButtonText" xml:space="preserve">
<value>Más</value>
<comment>Text for the nav view more button when panel is on top</comment>
</data>
<data name="NavigationViewItemDefaultControlName" xml:space="preserve">
<value>NavigationViewItem</value>
<comment>Default automation id if no name or id is provided</comment>
</data>
<data name="NavigationViewSearchButtonName" xml:space="preserve">
<value>Hacer clic para buscar</value>
<comment>Name for the compact view search button</comment>
</data>
<data name="SettingsButtonName" xml:space="preserve">
<value>Configuración</value>
<comment>Automation name for the settings button</comment>
</data>
</root>
Loading

0 comments on commit 9e5fda9

Please sign in to comment.