Skip to content

localization: move strings into resources #1535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<x:String x:Key="Text.Archive.Revision" xml:space="preserve">Revision:</x:String>
<x:String x:Key="Text.Archive.Title" xml:space="preserve">Archive</x:String>
<x:String x:Key="Text.Askpass" xml:space="preserve">SourceGit Askpass</x:String>
<x:String x:Key="Text.Askpass.Passphrase" xml:space="preserve">Enter passphrase:</x:String>
<x:String x:Key="Text.AssumeUnchanged" xml:space="preserve">FILES ASSUME UNCHANGED</x:String>
<x:String x:Key="Text.AssumeUnchanged.Empty" xml:space="preserve">NO FILES ASSUMED AS UNCHANGED</x:String>
<x:String x:Key="Text.AssumeUnchanged.Remove" xml:space="preserve">REMOVE</x:String>
Expand Down Expand Up @@ -149,17 +150,20 @@
<x:String x:Key="Text.CommitDetail.Info.ContainsIn" xml:space="preserve">Check refs that contains this commit</x:String>
<x:String x:Key="Text.CommitDetail.Info.ContainsIn.Title" xml:space="preserve">COMMIT IS CONTAINED BY</x:String>
<x:String x:Key="Text.CommitDetail.Info.GotoChangesPage" xml:space="preserve">Shows only the first 100 changes. See all changes on the CHANGES tab.</x:String>
<x:String x:Key="Text.CommitDetail.Info.Key" xml:space="preserve">Key:</x:String>
<x:String x:Key="Text.CommitDetail.Info.Message" xml:space="preserve">MESSAGE</x:String>
<x:String x:Key="Text.CommitDetail.Info.Parents" xml:space="preserve">PARENTS</x:String>
<x:String x:Key="Text.CommitDetail.Info.Refs" xml:space="preserve">REFS</x:String>
<x:String x:Key="Text.CommitDetail.Info.SHA" xml:space="preserve">SHA</x:String>
<x:String x:Key="Text.CommitDetail.Info.Signer" xml:space="preserve">Signer:</x:String>
<x:String x:Key="Text.CommitDetail.Info.WebLinks" xml:space="preserve">Open in Browser</x:String>
<x:String x:Key="Text.CommitMessageTextBox.MessagePlaceholder" xml:space="preserve">Description</x:String>
<x:String x:Key="Text.CommitMessageTextBox.SubjectCount" xml:space="preserve">SUBJECT</x:String>
<x:String x:Key="Text.CommitMessageTextBox.SubjectPlaceholder" xml:space="preserve">Enter commit subject</x:String>
<x:String x:Key="Text.Configure" xml:space="preserve">Repository Configure</x:String>
<x:String x:Key="Text.Configure.CommitMessageTemplate" xml:space="preserve">COMMIT TEMPLATE</x:String>
<x:String x:Key="Text.Configure.CommitMessageTemplate.Content" xml:space="preserve">Template Content:</x:String>
<x:String x:Key="Text.Configure.CommitMessageTemplate.Explanation" xml:space="preserve">You can use ${files_num}, ${branch_name}, ${files} and ${files:N} where N is the max number of file paths to output.</x:String>
<x:String x:Key="Text.Configure.CommitMessageTemplate.Name" xml:space="preserve">Template Name:</x:String>
<x:String x:Key="Text.Configure.CustomAction" xml:space="preserve">CUSTOM ACTION</x:String>
<x:String x:Key="Text.Configure.CustomAction.Arguments" xml:space="preserve">Arguments:</x:String>
Expand Down Expand Up @@ -220,6 +224,8 @@
<x:String x:Key="Text.ConfirmEmptyCommit.NoLocalChanges" xml:space="preserve">Empty commit detected! Do you want to continue (--allow-empty)?</x:String>
<x:String x:Key="Text.ConfirmEmptyCommit.StageAllThenCommit" xml:space="preserve">STAGE ALL &amp; COMMIT</x:String>
<x:String x:Key="Text.ConfirmEmptyCommit.WithLocalChanges" xml:space="preserve">Empty commit detected! Do you want to continue (--allow-empty) or stage all then commit?</x:String>
<x:String x:Key="Text.ConfirmRestart.Title" xml:space="preserve">Restart Required</x:String>
<x:String x:Key="Text.ConfirmRestart.Message" xml:space="preserve">You need to restart this app to apply changes.</x:String>
<x:String x:Key="Text.ConventionalCommit" xml:space="preserve">Conventional Commit Helper</x:String>
<x:String x:Key="Text.ConventionalCommit.BreakingChanges" xml:space="preserve">Breaking Change:</x:String>
<x:String x:Key="Text.ConventionalCommit.ClosedIssue" xml:space="preserve">Closed Issue:</x:String>
Expand Down Expand Up @@ -285,6 +291,9 @@
<x:String x:Key="Text.Diff.FileModeChanged" xml:space="preserve">File Mode Changed</x:String>
<x:String x:Key="Text.Diff.First" xml:space="preserve">First Difference</x:String>
<x:String x:Key="Text.Diff.IgnoreWhitespace" xml:space="preserve">Ignore All Whitespace Changes</x:String>
<x:String x:Key="Text.Diff.Image.SideBySide" xml:space="preserve">SIDE-BY-SIDE</x:String>
<x:String x:Key="Text.Diff.Image.Swipe" xml:space="preserve">SWIPE</x:String>
<x:String x:Key="Text.Diff.Image.Blend" xml:space="preserve">BLEND</x:String>
<x:String x:Key="Text.Diff.Last" xml:space="preserve">Last Difference</x:String>
<x:String x:Key="Text.Diff.LFS" xml:space="preserve">LFS OBJECT CHANGE</x:String>
<x:String x:Key="Text.Diff.Next" xml:space="preserve">Next Difference</x:String>
Expand Down Expand Up @@ -452,8 +461,14 @@
<x:String x:Key="Text.InProgress.Revert" xml:space="preserve">Revert in progress.</x:String>
<x:String x:Key="Text.InProgress.Revert.Head" xml:space="preserve">Reverting commit</x:String>
<x:String x:Key="Text.InteractiveRebase" xml:space="preserve">Interactive Rebase</x:String>
<x:String x:Key="Text.InteractiveRebase.Drop.Message" xml:space="preserve">Remove commit</x:String>
<x:String x:Key="Text.InteractiveRebase.Edit.Message" xml:space="preserve">Stop for amending</x:String>
<x:String x:Key="Text.InteractiveRebase.Fixup.Message" xml:space="preserve">Like 'Squash' but discard message</x:String>
<x:String x:Key="Text.InteractiveRebase.On" xml:space="preserve">On:</x:String>
<x:String x:Key="Text.InteractiveRebase.Pick.Message" xml:space="preserve">Use this commit</x:String>
<x:String x:Key="Text.InteractiveRebase.ReorderTip" xml:space="preserve">Drag-drop to reorder commits</x:String>
<x:String x:Key="Text.InteractiveRebase.Reword.Message" xml:space="preserve">Edit the commit message</x:String>
<x:String x:Key="Text.InteractiveRebase.Squash.Message" xml:space="preserve">Squash into previous commit</x:String>
<x:String x:Key="Text.InteractiveRebase.Target" xml:space="preserve">Target Branch:</x:String>
<x:String x:Key="Text.IssueLinkCM.CopyLink" xml:space="preserve">Copy Link</x:String>
<x:String x:Key="Text.IssueLinkCM.OpenInBrowser" xml:space="preserve">Open in Browser</x:String>
Expand Down Expand Up @@ -577,6 +592,7 @@
<x:String x:Key="Text.Push.CheckSubmodules" xml:space="preserve">Make sure submodules have been pushed</x:String>
<x:String x:Key="Text.Push.Force" xml:space="preserve">Force push</x:String>
<x:String x:Key="Text.Push.Local" xml:space="preserve">Local Branch:</x:String>
<x:String x:Key="Text.Push.New" xml:space="preserve">NEW</x:String>
<x:String x:Key="Text.Push.Remote" xml:space="preserve">Remote:</x:String>
<x:String x:Key="Text.Push.Revision" xml:space="preserve">Revision:</x:String>
<x:String x:Key="Text.Push.Revision.Title" xml:space="preserve">Push Revision To Remote</x:String>
Expand Down
2 changes: 1 addition & 1 deletion src/Views/Askpass.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<StackPanel Grid.Row="1" Margin="0,16" Orientation="Vertical">
<Border Margin="16,0">
<TextBlock x:Name="TxtDescription" Text="Enter passphrase:" TextWrapping="Wrap"/>
<TextBlock x:Name="TxtDescription" Text="{DynamicResource Text.Askpass.Passphrase}" TextWrapping="Wrap"/>
</Border>

<TextBox x:Name="TxtPassphrase"
Expand Down
4 changes: 2 additions & 2 deletions src/Views/CommitBaseInfo.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
<StackPanel Orientation="Vertical">
<TextBlock Margin="0,0,0,12" Text="{Binding ToolTip}"/>
<Grid ColumnDefinitions="Auto,8,Auto" RowDefinitions="Auto,Auto">
<TextBlock Grid.Row="0" Grid.Column="0" Text="Signer:" IsVisible="{Binding HasSigner}" VerticalAlignment="Center"/>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource Text.CommitDetail.Info.Signer}" IsVisible="{Binding HasSigner}" VerticalAlignment="Center"/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Signer}" IsVisible="{Binding HasSigner}" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Key:" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource Text.CommitDetail.Info.Key}" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Key}" VerticalAlignment="Center"/>
</Grid>
</StackPanel>
Expand Down
2 changes: 1 addition & 1 deletion src/Views/CommitMessageEditor.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</Grid>

<StackPanel Grid.Row="1" Orientation="Vertical" Margin="8">
<v:CommitMessageTextBox x:Name="Editor" Height="400" Text=""/>
<v:CommitMessageTextBox x:Name="Editor" Height="400"/>
<Button Classes="flat primary"
Width="80"
Margin="0,8,0,4"
Expand Down
4 changes: 2 additions & 2 deletions src/Views/ConfirmRestart.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
IsVisible="{OnPlatform True, macOS=False}"/>

<TextBlock Classes="bold"
Text="Restart Required"
Text="{DynamicResource Text.ConfirmRestart.Title}"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False"/>

Expand All @@ -36,7 +36,7 @@

<StackPanel Grid.Row="1" Margin="0,16" Orientation="Vertical">
<Border Margin="16,0">
<TextBlock Text="You need to restart this app to apply changes."/>
<TextBlock Text="{DynamicResource Text.ConfirmRestart.Message}"/>
</Border>

<Button Classes="flat primary"
Expand Down
10 changes: 5 additions & 5 deletions src/Views/ImageDiffView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<TabItem>
<TabItem.Header>
<TextBlock Text="SIDE-BY-SIDE" FontSize="11"/>
<TextBlock Text="{DynamicResource Text.Diff.Image.SideBySide}" FontSize="11"/>
</TabItem.Header>

<UniformGrid Rows="1" Margin="0,16" HorizontalAlignment="Center" VerticalAlignment="Center">
Expand Down Expand Up @@ -63,7 +63,7 @@

<TabItem>
<TabItem.Header>
<TextBlock Text="SWIPE" FontSize="11"/>
<TextBlock Text="{DynamicResource Text.Diff.Image.Swipe}" FontSize="11"/>
</TabItem.Header>

<Grid RowDefinitions="Auto,*" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,16">
Expand Down Expand Up @@ -97,7 +97,7 @@

<TabItem>
<TabItem.Header>
<TextBlock Text="BLEND" FontSize="11"/>
<TextBlock Text="{DynamicResource Text.Diff.Image.Blend}" FontSize="11"/>
</TabItem.Header>

<Grid RowDefinitions="Auto,*,Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,16,8,0">
Expand Down Expand Up @@ -129,7 +129,7 @@

<Grid Grid.Row="2" ColumnDefinitions="100,200,100" Margin="0,12,0,0" HorizontalAlignment="Center">
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,8,0">
<TextBlock Classes="primary" Text="OLD"/>
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Binary.Old}"/>
<TextBlock Classes="primary"
Margin="8,0,0,0"
Text="{Binding #ImageBlendSlider.Value, Converter={x:Static c:DoubleConverters.OneMinusToPercentage}}"
Expand All @@ -147,7 +147,7 @@
Value="0.5"/>

<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Top" Margin="8,0,0,0">
<TextBlock Classes="primary" Text="NEW"/>
<TextBlock Classes="primary" Text="{DynamicResource Text.Diff.Binary.New}"/>
<TextBlock Classes="primary"
Margin="8,0,0,0"
Text="{Binding #ImageBlendSlider.Value, Converter={x:Static c:DoubleConverters.ToPercentage}}"
Expand Down
19 changes: 10 additions & 9 deletions src/Views/InteractiveRebase.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ private void OnButtonActionClicked(object sender, RoutedEventArgs e)
flyout.Placement = PlacementMode.BottomEdgeAlignedLeft;
flyout.VerticalOffset = -4;

CreateActionMenuItem(flyout, Brushes.Green, "Pick", "Use this commit", "P", item, Models.InteractiveRebaseAction.Pick);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action name like Pick, Squash etc. should not be translated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, in that case can we use the enum name?

CreateActionMenuItem(flyout, Brushes.Orange, "Edit", "Stop for amending", "E", item, Models.InteractiveRebaseAction.Edit);
CreateActionMenuItem(flyout, Brushes.Orange, "Reword", "Edit the commit message", "R", item, Models.InteractiveRebaseAction.Reword);
CreateActionMenuItem(flyout, Brushes.Green, Models.InteractiveRebaseAction.Pick, App.Text("InteractiveRebase.Pick.Message"), item);
CreateActionMenuItem(flyout, Brushes.Orange, Models.InteractiveRebaseAction.Edit, App.Text("InteractiveRebase.Edit.Message"), item);
CreateActionMenuItem(flyout, Brushes.Orange, Models.InteractiveRebaseAction.Reword, App.Text("InteractiveRebase.Reword.Message"), item);

if (item.CanSquashOrFixup)
{
CreateActionMenuItem(flyout, Brushes.LightGray, "Squash", "Meld into previous commit", "S", item, Models.InteractiveRebaseAction.Squash);
CreateActionMenuItem(flyout, Brushes.LightGray, "Fixup", "Like 'Squash' but discard message", "F", item, Models.InteractiveRebaseAction.Fixup);
CreateActionMenuItem(flyout, Brushes.LightGray, Models.InteractiveRebaseAction.Squash, App.Text("InteractiveRebase.Squash.Message"), item);
CreateActionMenuItem(flyout, Brushes.LightGray, Models.InteractiveRebaseAction.Fixup, App.Text("InteractiveRebase.Fixup.Message"), item);
}

CreateActionMenuItem(flyout, Brushes.Red, "Drop", "Remove commit", "D", item, Models.InteractiveRebaseAction.Drop);
CreateActionMenuItem(flyout, Brushes.Red, Models.InteractiveRebaseAction.Drop, App.Text("InteractiveRebase.Drop.Message"), item);

flyout.ShowAt(button);
e.Handled = true;
Expand Down Expand Up @@ -202,8 +202,9 @@ private async void OnStartJobs(object _1, RoutedEventArgs _2)
Close();
}

private void CreateActionMenuItem(MenuFlyout flyout, IBrush iconBrush, string label, string desc, string hotkey, ViewModels.InteractiveRebaseItem item, Models.InteractiveRebaseAction action)
private void CreateActionMenuItem(MenuFlyout flyout, IBrush iconBrush, Models.InteractiveRebaseAction action, string desc, ViewModels.InteractiveRebaseItem item)
{
var name = action.ToString();
var header = new Grid()
{
ColumnDefinitions =
Expand All @@ -217,7 +218,7 @@ private void CreateActionMenuItem(MenuFlyout flyout, IBrush iconBrush, string la
{
[Grid.ColumnProperty] = 0,
Margin = new Thickness(4, 0),
Text = label
Text = name
},
new TextBlock()
{
Expand All @@ -231,7 +232,7 @@ private void CreateActionMenuItem(MenuFlyout flyout, IBrush iconBrush, string la
var menuItem = new MenuItem();
menuItem.Icon = new Ellipse() { Width = 14, Height = 14, Fill = iconBrush };
menuItem.Header = header;
menuItem.Tag = hotkey;
menuItem.Tag = name[0];
menuItem.Click += (_, e) =>
{
if (DataContext is ViewModels.InteractiveRebase vm)
Expand Down
2 changes: 1 addition & 1 deletion src/Views/Push.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
VerticalAlignment="Center"
Background="Green"
IsVisible="{Binding Head, Converter={x:Static StringConverters.IsNullOrEmpty}}">
<TextBlock Text="NEW" FontSize="9" FontFamily="{DynamicResource Fonts.Monospace}" Foreground="White" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Text.Push.New}" FontSize="9" FontFamily="{DynamicResource Fonts.Monospace}" Foreground="White" VerticalAlignment="Center"/>
</Border>
</StackPanel>
</DataTemplate>
Expand Down
2 changes: 1 addition & 1 deletion src/Views/RepositoryConfigure.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
<TextBlock Margin="0,12,0,0" Text="{DynamicResource Text.Configure.CommitMessageTemplate.Content}"/>
<v:CommitMessageTextBox Margin="0,4,0,0" Height="150" Text="{Binding Content, Mode=TwoWay}"/>
<TextBlock Margin="0,2,0,0"
Text="You can use ${files_num}, ${branch_name}, ${files} and ${files:N} where N is the max number of file paths to output."
Text="{DynamicResource Text.Configure.CommitMessageTemplate.Explanation}"
Foreground="{DynamicResource Brush.FG2}"
TextWrapping="Wrap"/>
</StackPanel>
Expand Down