ux: use localized text instead of hard-coded string annotated (#1305)

This commit is contained in:
leo 2025-05-13 13:01:15 +08:00
parent afc8a772dd
commit 142ee5a327
No known key found for this signature in database
2 changed files with 9 additions and 10 deletions

View file

@ -29,14 +29,13 @@ namespace SourceGit.Commands
continue; continue;
var name = subs[0].Substring(10); var name = subs[0].Substring(10);
var message = subs[5].Trim();
tags.Add(new Models.Tag() tags.Add(new Models.Tag()
{ {
Name = name, Name = name,
IsAnnotated = subs[1].Equals("tag", StringComparison.Ordinal), IsAnnotated = subs[1].Equals("tag", StringComparison.Ordinal),
SHA = string.IsNullOrEmpty(subs[3]) ? subs[2] : subs[3], SHA = string.IsNullOrEmpty(subs[3]) ? subs[2] : subs[3],
CreatorDate = ulong.Parse(subs[4]), CreatorDate = ulong.Parse(subs[4]),
Message = string.IsNullOrEmpty(message) ? name : message, Message = subs[5].Trim(),
}); });
} }

View file

@ -29,16 +29,16 @@
<Border Height="24" Background="Transparent" PointerPressed="OnRowPointerPressed" DoubleTapped="OnDoubleTappedNode" ContextRequested="OnRowContextRequested" ToolTip.Tip="{Binding ToolTip}"> <Border Height="24" Background="Transparent" PointerPressed="OnRowPointerPressed" DoubleTapped="OnDoubleTappedNode" ContextRequested="OnRowContextRequested" ToolTip.Tip="{Binding ToolTip}">
<Border.DataTemplates> <Border.DataTemplates>
<DataTemplate DataType="vm:TagTreeNodeToolTip"> <DataTemplate DataType="vm:TagTreeNodeToolTip">
<StackPanel Orientation="Vertical" MinWidth="200"> <StackPanel Orientation="Vertical" Spacing="6">
<StackPanel Orientation="Horizontal" Margin="0,0,0,6"> <StackPanel Orientation="Horizontal">
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/> <Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/>
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/> <TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/>
<Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}"> <Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}">
<TextBlock Text="annotated" Classes="primary" Margin="4,0" Foreground="#FFDDDDDD"/> <TextBlock Text="{DynamicResource Text.CreateTag.Type.Annotated}" Classes="primary" Margin="4,0" Foreground="#FFDDDDDD"/>
</Border> </Border>
</StackPanel> </StackPanel>
<TextBlock Text="{Binding Message}"/> <TextBlock Text="{Binding Message}" IsVisible="{Binding Message, Converter={x:Static c:StringConverters.IsNotNullOrWhitespace}}"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</Border.DataTemplates> </Border.DataTemplates>
@ -86,16 +86,16 @@
<DataTemplate DataType="m:Tag"> <DataTemplate DataType="m:Tag">
<Border Height="24" Background="Transparent" PointerPressed="OnRowPointerPressed" ContextRequested="OnRowContextRequested"> <Border Height="24" Background="Transparent" PointerPressed="OnRowPointerPressed" ContextRequested="OnRowContextRequested">
<ToolTip.Tip> <ToolTip.Tip>
<StackPanel Orientation="Vertical" MinWidth="200"> <StackPanel Orientation="Vertical" Spacing="6">
<StackPanel Orientation="Horizontal" Margin="0,0,0,6"> <StackPanel Orientation="Horizontal">
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/> <Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/>
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/> <TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/>
<Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}"> <Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}">
<TextBlock Text="annotated" Classes="primary" Margin="4,0" Foreground="#FFDDDDDD"/> <TextBlock Text="{DynamicResource Text.CreateTag.Type.Annotated}" Classes="primary" Margin="4,0" Foreground="#FFDDDDDD"/>
</Border> </Border>
</StackPanel> </StackPanel>
<TextBlock Text="{Binding Message}"/> <TextBlock Text="{Binding Message}" IsVisible="{Binding Message, Converter={x:Static c:StringConverters.IsNotNullOrWhitespace}}"/>
</StackPanel> </StackPanel>
</ToolTip.Tip> </ToolTip.Tip>