Skip to content

Commit

Permalink
Merge pull request #3460 from michael-hawker/mhawker/localization-ove…
Browse files Browse the repository at this point in the history
…rride-fix

Application Developer Localization Override Fix
  • Loading branch information
michael-hawker committed Sep 17, 2020
2 parents 0e2d49f + 4ad2a12 commit e3c08ac
Show file tree
Hide file tree
Showing 21 changed files with 560 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ async Task<Stream> CopyStream(HttpContent source)
// Takes a second copy of the image stream, so that is can save the image data to cache.
using (var saveStream = await CopyStream(response.Content))
{
await SaveImageToCache(localpath, saveStream);
await SaveImageToCache(localPath, saveStream);
}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public override void FormatLink(ToolbarButton button, string label, string forma
{
var select = Formatter.Selected;
int originalStart = Formatter.Selected.StartPosition;
string urlLabel = StringExtensions.GetLocalized("TextToolbarStrings_UrlLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string labelLabel = StringExtensions.GetLocalized("TextToolbarStrings_LabelLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string urlLabel = "WCT_TextToolbar_UrlLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string labelLabel = "WCT_TextToolbar_LabelLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");

// Replaces Selection of first Line only.
if (select.Text.Contains("\r"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void StyleHeader(ToolbarButton button)
{
Content = new MarkdownTextBlock
{
Text = val + StringExtensions.GetLocalized("TextToolbarStrings_HeaderLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Text = val + "WCT_TextToolbar_HeaderLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
IsTextSelectionEnabled = false
},
Tag = val,
Expand Down Expand Up @@ -462,7 +462,7 @@ public override ButtonMap DefaultButtons
QuoteButton = new ToolbarButton
{
Name = QuoteElement,
ToolTip = StringExtensions.GetLocalized("TextToolbarStrings_QuoteLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
ToolTip = "WCT_TextToolbar_QuoteLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Icon = new SymbolIcon { Symbol = Symbol.Message },
Activation = FormatQuote
};
Expand All @@ -479,13 +479,13 @@ public override ButtonMap DefaultButtons
{
Name = HeadersElement,
Icon = new SymbolIcon { Symbol = Symbol.FontSize },
ToolTip = StringExtensions.GetLocalized("TextToolbarStrings_HeaderLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
ToolTip = "WCT_TextToolbar_HeaderLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Activation = StyleHeader
},
new ToolbarButton
{
Name = CodeElement,
ToolTip = StringExtensions.GetLocalized("TextToolbarStrings_CodeLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
ToolTip = "WCT_TextToolbar_CodeLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Icon = new FontIcon { Glyph = "{}", FontFamily = new FontFamily("Segoe UI"), Margin = new Thickness(0, -5, 0, 0) },
Activation = FormatCode
},
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.Toolkit.Uwp.UI.Controls/BladeView/BladeItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected override void OnExpanded(EventArgs args)
{
Width = _normalModeWidth;
VisualStateManager.GoToState(this, "Expanded", true);
var name = StringExtensions.GetLocalized("WindowsCommunityToolkit_BladeView_ExpandButton_Collapsed", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
var name = "WCT_BladeView_ExpandButton_Collapsed".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
if (_enlargeButton != null)
{
AutomationProperties.SetName(_enlargeButton, name);
Expand All @@ -84,7 +84,7 @@ protected override void OnCollapsed(EventArgs args)
{
Width = double.NaN;
VisualStateManager.GoToState(this, "Collapsed", true);
var name = StringExtensions.GetLocalized("WindowsCommunityToolkit_BladeView_ExpandButton_Expanded", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
var name = "WCT_BladeView_ExpandButton_Expanded".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
if (_enlargeButton != null)
{
AutomationProperties.SetName(_enlargeButton, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public GridSplitter()
{
DefaultStyleKey = typeof(GridSplitter);
Loaded += GridSplitter_Loaded;
string automationName = StringExtensions.GetLocalized("WindowsCommunityToolkit_GridSplitter_AutomationName", "/Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string automationName = "WCT_GridSplitter_AutomationName".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
AutomationProperties.SetName(this, automationName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected override void OnApplyTemplate()
{
_dismissButton.Visibility = ShowDismissButton ? Visibility.Visible : Visibility.Collapsed;
_dismissButton.Click += DismissButton_Click;
AutomationProperties.SetName(_dismissButton, StringExtensions.GetLocalized("WindowsCommunityToolkit_InAppNotification_DismissButton_AutomationName", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"));
AutomationProperties.SetName(_dismissButton, "WCT_InAppNotification_DismissButton_AutomationName".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"));
}

if (_visualStateGroup != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Setter Property="HorizontalOffset" Value="0" />
<Setter Property="AutomationProperties.LandmarkType" Value="Custom" />
<!-- The setter value is localized using x:Uid but we still need to set it explicitly to avoid a compiler warning -->
<Setter x:Uid="WindowsCommunityToolkit_InAppNotification_LandmarkProperty" Property="AutomationProperties.LocalizedLandmarkType" Value="Notification" />
<Setter x:Uid="WCT_InAppNotification_LandmarkProperty" Property="AutomationProperties.LocalizedLandmarkType" Value="Notification" />
<Setter Property="AutomationProperties.LiveSetting" Value="Assertive" />
<Setter Property="Template" Value="{StaticResource MSEdgeNotificationTemplate}" />
</Style>
Expand Down
52 changes: 26 additions & 26 deletions Microsoft.Toolkit.Uwp.UI.Controls/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -117,107 +117,107 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TextToolbarStrings_BoldLabel" xml:space="preserve">
<data name="WCT_TextToolbar_BoldLabel" xml:space="preserve">
<value>Bold</value>
<comment>Label for TextToolbar Control bold button.</comment>
</data>
<data name="TextToolbarStrings_CancelLabel" xml:space="preserve">
<data name="WCT_TextToolbar_CancelLabel" xml:space="preserve">
<value>Cancel</value>
<comment>Label for TextToolbar Control Cancel message.</comment>
</data>
<data name="TextToolbarStrings_CodeLabel" xml:space="preserve">
<data name="WCT_TextToolbar_CodeLabel" xml:space="preserve">
<value>Code</value>
<comment>Label for TextToolbar Control Code button.</comment>
</data>
<data name="TextToolbarStrings_CreateLinkLabel" xml:space="preserve">
<data name="WCT_TextToolbar_CreateLinkLabel" xml:space="preserve">
<value>Create Link</value>
<comment>Label for TextToolbar Control Create Link button.</comment>
</data>
<data name="TextToolbarStrings_EmptyTextLabel" xml:space="preserve">
<data name="WCT_TextToolbar_EmptyTextLabel" xml:space="preserve">
<value>Empty Text</value>
<comment>Label for TextToolbar Control Empty Text.</comment>
</data>
<data name="TextToolbarStrings_HeaderLabel" xml:space="preserve">
<data name="WCT_TextToolbar_HeaderLabel" xml:space="preserve">
<value>Header</value>
<comment>Label for TextToolbar Control Header button.</comment>
</data>
<data name="TextToolbarStrings_ItalicsLabel" xml:space="preserve">
<data name="WCT_TextToolbar_ItalicsLabel" xml:space="preserve">
<value>Italics</value>
<comment>Label for TextToolbar Control italics button.</comment>
</data>
<data name="TextToolbarStrings_LabelLabel" xml:space="preserve">
<data name="WCT_TextToolbar_LabelLabel" xml:space="preserve">
<value>Label</value>
<comment>Label for TextToolbar Control Label button.</comment>
</data>
<data name="TextToolbarStrings_LinkInvalidLabel" xml:space="preserve">
<data name="WCT_TextToolbar_LinkInvalidLabel" xml:space="preserve">
<value>Link Invalid</value>
<comment>Label for TextToolbar Control Link Invalid message.</comment>
</data>
<data name="TextToolbarStrings_LinkLabel" xml:space="preserve">
<data name="WCT_TextToolbar_LinkLabel" xml:space="preserve">
<value>Link</value>
<comment>Label for TextToolbar Control Link button.</comment>
</data>
<data name="TextToolbarStrings_ListLabel" xml:space="preserve">
<data name="WCT_TextToolbar_ListLabel" xml:space="preserve">
<value>List</value>
<comment>Label for TextToolbar Control List button.</comment>
</data>
<data name="TextToolbarStrings_OkLabel" xml:space="preserve">
<data name="WCT_TextToolbar_OkLabel" xml:space="preserve">
<value>Ok</value>
<comment>Label for TextToolbar Control Ok message.</comment>
</data>
<data name="TextToolbarStrings_OrderedListLabel" xml:space="preserve">
<data name="WCT_TextToolbar_OrderedListLabel" xml:space="preserve">
<value>Ordered List</value>
<comment>Label for TextToolbar Control Ordered List button.</comment>
</data>
<data name="TextToolbarStrings_QuoteLabel" xml:space="preserve">
<data name="WCT_TextToolbar_QuoteLabel" xml:space="preserve">
<value>Quote</value>
<comment>Label for TextToolbar Control Quote button.</comment>
</data>
<data name="TextToolbarStrings_RelativeLabel" xml:space="preserve">
<data name="WCT_TextToolbar_RelativeLabel" xml:space="preserve">
<value>Relative</value>
<comment>Label for TextToolbar Control Relative.</comment>
</data>
<data name="TextToolbarStrings_StrikethroughLabel" xml:space="preserve">
<data name="WCT_TextToolbar_StrikethroughLabel" xml:space="preserve">
<value>Strikethrough</value>
<comment>Label for TextToolbar Control Strikethrough button.</comment>
</data>
<data name="TextToolbarStrings_UnderlineLabel" xml:space="preserve">
<data name="WCT_TextToolbar_UnderlineLabel" xml:space="preserve">
<value>Underline</value>
<comment>Label for TextToolbar Control Underline button.</comment>
</data>
<data name="TextToolbarStrings_UrlLabel" xml:space="preserve">
<data name="WCT_TextToolbar_UrlLabel" xml:space="preserve">
<value>Url</value>
<comment>Label for TextToolbar Control Url button.</comment>
</data>
<data name="TextToolbarStrings_WarningLabel" xml:space="preserve">
<data name="WCT_TextToolbar_WarningLabel" xml:space="preserve">
<value>Warning</value>
<comment>Label for TextToolbar Control Warning message.</comment>
</data>
<data name="WindowsCommunityToolkit_BladeView_ExpandButton_Collapsed" xml:space="preserve">
<data name="WCT_BladeView_ExpandButton_Collapsed" xml:space="preserve">
<value>Collapse Blade</value>
<comment>Narrator Resource for BladeView collapsed status</comment>
</data>
<data name="WindowsCommunityToolkit_BladeView_ExpandButton_Expanded" xml:space="preserve">
<data name="WCT_BladeView_ExpandButton_Expanded" xml:space="preserve">
<value>Expand Blade</value>
<comment>Narrator Resource for BladeView expanded status</comment>
</data>
<data name="WindowsCommunityToolkit_GridSplitter_AutomationName" xml:space="preserve">
<data name="WCT_GridSplitter_AutomationName" xml:space="preserve">
<value>GridSplitter</value>
<comment>Narrator Resource for GridSplitter control</comment>
</data>
<data name="WindowsCommunityToolkit_InAppNotification_DismissButton_AutomationName" xml:space="preserve">
<data name="WCT_InAppNotification_DismissButton_AutomationName" xml:space="preserve">
<value>Dismiss</value>
<comment>The automation name for the dismiss button of the InAppNotification control.</comment>
</data>
<data name="WindowsCommunityToolkit_InAppNotification_LandmarkProperty.Value" xml:space="preserve">
<data name="WCT_InAppNotification_LandmarkProperty.Value" xml:space="preserve">
<value>Notification</value>
<comment>The landmark name for the InAppNotification control. It is said by the narrator when using landmark navigation.</comment>
</data>
<data name="WindowsCommunityToolkit_TokenizingTextBoxItem_MenuFlyout_Remove" xml:space="preserve">
<data name="WCT_TokenizingTextBoxItem_MenuFlyout_Remove" xml:space="preserve">
<value>Remove</value>
<comment>Label for TokenizingTextBox MenuFlyout 'Remove' option.</comment>
</data>
<data name="WindowsCommunityToolkit_TokenizingTextBox_MenuFlyout_SelectAll" xml:space="preserve">
<data name="WCT_TokenizingTextBox_MenuFlyout_SelectAll" xml:space="preserve">
<value>Select All</value>
<comment>Label for TokenizingTextBox MenuFlyout 'Select All' option.</comment>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public override ButtonMap DefaultButtons
StrikeButton = CommonButtons.Strikethrough;
Underline = new ToolbarButton
{
ToolTip = StringExtensions.GetLocalized("TextToolbarStrings_UnderlineLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
ToolTip = "WCT_TextToolbar_UnderlineLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Icon = new SymbolIcon { Symbol = Symbol.Underline },
ShortcutKey = VirtualKey.U,
Activation = ((RichTextButtonActions)ButtonActions).FormatUnderline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public async void OpenLinkCreator(ToolbarButton button)

var labelBox = new RichEditBox
{
PlaceholderText = StringExtensions.GetLocalized("TextToolbarStrings_LabelLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
PlaceholderText = "WCT_TextToolbar_LabelLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Margin = new Thickness(0, 0, 0, 5),
AcceptsReturn = false
};
var linkBox = new TextBox
{
PlaceholderText = StringExtensions.GetLocalized("TextToolbarStrings_UrlLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources")
PlaceholderText = "WCT_TextToolbar_UrlLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources")
};

CheckBox relativeBox = null;
Expand All @@ -78,7 +78,7 @@ public async void OpenLinkCreator(ToolbarButton button)
{
relativeBox = new CheckBox
{
Content = StringExtensions.GetLocalized("TextToolbarStrings_RelativeLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources")
Content = "WCT_TextToolbar_RelativeLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources")
};
contentPanel.Children.Add(relativeBox);
}
Expand All @@ -89,10 +89,10 @@ public async void OpenLinkCreator(ToolbarButton button)

var contentDialog = new ContentDialog
{
Title = StringExtensions.GetLocalized("TextToolbarStrings_CreateLinkLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Title = "WCT_TextToolbar_CreateLinkLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
Content = contentPanel,
PrimaryButtonText = StringExtensions.GetLocalized("TextToolbarStrings_OkLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
SecondaryButtonText = StringExtensions.GetLocalized("TextToolbarStrings_CancelLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources")
PrimaryButtonText = "WCT_TextToolbar_OkLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
SecondaryButtonText = "WCT_TextToolbar_CancelLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources")
};

if (ControlHelpers.IsXamlRootAvailable && button.XamlRoot != null)
Expand All @@ -107,9 +107,9 @@ public async void OpenLinkCreator(ToolbarButton button)
labelBox.Document.GetText(Windows.UI.Text.TextGetOptions.None, out string labelText);
labelBox.Document.GetText(Windows.UI.Text.TextGetOptions.FormatRtf, out string formattedlabelText);

string linkInvalidLabel = StringExtensions.GetLocalized("TextToolbarStrings_LinkInvalidLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string okLabel = StringExtensions.GetLocalized("TextToolbarStrings_OkLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string warningLabel = StringExtensions.GetLocalized("TextToolbarStrings_WarningLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string linkInvalidLabel = "WCT_TextToolbar_LinkInvalidLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string okLabel = "WCT_TextToolbar_OkLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string warningLabel = "WCT_TextToolbar_WarningLabel".GetLocalized("Microsoft.Toolkit.Uwp.UI.Controls/Resources");
string linkText = linkBox.Text.Trim();

if (string.IsNullOrWhiteSpace(linkText))
Expand Down
Loading

0 comments on commit e3c08ac

Please sign in to comment.