Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
fix(i18n): keep translated toolbar actions and preview labels readable
BlackSpiritsd21e2a6107ba
diff --git a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.csindex 1d05900d..b79eaa1a 100644--- a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs@@ -485,7 +485,7 @@ public sealed partial class ToolbarPageViewModel : ObservableObject, IDisposableDonutItems = used.Select(_store.FindPreset).OfType<Preset>()- .Select(p => new DonutItem { Id = p.Id, Label = _loc.DisplayName(p), Caption = Caption(p) })+ .Select(p => new DonutItem { Id = p.Id, Label = _loc.DonutName(p), Caption = Caption(p) }).ToList();Palette.Clear();diff --git a/src/Filee.App/Views/Pages/ToolbarPage.axaml b/src/Filee.App/Views/Pages/ToolbarPage.axamlindex a4487fc4..237be6e0 100644--- a/src/Filee.App/Views/Pages/ToolbarPage.axaml+++ b/src/Filee.App/Views/Pages/ToolbarPage.axaml@@ -332,23 +332,23 @@<!-- Palette --><StackPanel Grid.Column="4" Spacing="8"><TextBlock Classes="label" Text="{DynamicResource toolbar.available}" />- <!-- Two to a row in a narrow column: little padding, centred, and an ellipsis rather than text past the edge. -->- <Grid ColumnDefinitions="*,6,*">- <Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Padding="6,6"+ <!-- Keep complete action labels; longer translations can move the second action to the next row. -->+ <WrapPanel>+ <Button x:Name="NewPresetButton" Margin="0,0,6,6" HorizontalContentAlignment="Center" Padding="6,6"Command="{Binding NewPresetCommand}" ToolTip.Tip="{DynamicResource toolbar.new_preset}"><StackPanel Orientation="Horizontal" Spacing="5"><PathIcon Width="12" Height="12" Data="{StaticResource Icon.Plus}" />- <TextBlock Text="{DynamicResource toolbar.new_preset}" TextTrimming="CharacterEllipsis" />+ <TextBlock Text="{DynamicResource toolbar.new_preset}" /></StackPanel></Button>- <Button Grid.Column="2" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Padding="6,6"+ <Button x:Name="NewGroupButton" Margin="0,0,0,6" HorizontalContentAlignment="Center" Padding="6,6"Command="{Binding NewGroupCommand}" ToolTip.Tip="{DynamicResource group.hint}"><StackPanel Orientation="Horizontal" Spacing="5"><PathIcon Width="12" Height="12" Data="{StaticResource Icon.Donut}" />- <TextBlock Text="{DynamicResource toolbar.new_group}" TextTrimming="CharacterEllipsis" />+ <TextBlock Text="{DynamicResource toolbar.new_group}" /></StackPanel></Button>- </Grid>+ </WrapPanel><TextBox Classes="search clearButton" Text="{Binding PaletteSearch}" Watermark="{DynamicResource common.search}"><TextBox.InnerLeftContent><PathIcon Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource TextSecondaryBrush}" />diff --git a/tests/Filee.App.Tests/PortugueseLocalizationTests.cs b/tests/Filee.App.Tests/PortugueseLocalizationTests.csindex 04cab03e..3b6b5a48 100644--- a/tests/Filee.App.Tests/PortugueseLocalizationTests.cs+++ b/tests/Filee.App.Tests/PortugueseLocalizationTests.cs@@ -189,7 +189,8 @@ public class PortugueseLocalizationTests// These are real folder names/CLI arguments, not translatable labels.Assert.Matches(@"\boriginals\b", translated["watch.originals_move"]);Assert.Matches(@"\bconverted\b", translated["watch.output_placeholder"]);- Assert.Contains("filee watch <folder> --to <format>", translated["watch.cli_hint"]);+ // Argument descriptions may be translated; the command and option are literal.+ Assert.Matches(@"filee watch <[^>]+> --to <[^>]+>", translated["watch.cli_hint"]);Assert.Contains(@"IMG_(\d+)", translated["watch.rename_find"]);Assert.Contains("$1", translated["watch.rename_replace"]);}diff --git a/tests/Filee.App.Tests/PortugueseRenderTests.cs b/tests/Filee.App.Tests/PortugueseRenderTests.csindex 81093a40..ca35a6ae 100644--- a/tests/Filee.App.Tests/PortugueseRenderTests.cs+++ b/tests/Filee.App.Tests/PortugueseRenderTests.cs@@ -193,6 +193,8 @@ public class PortugueseRenderTestsforeach (var language in new[] { "en", "pt-PT", "pt-BR" })foreach (var page in new[] { "toolbar", "theme", "presets", "engines" })data.Add(language, page);+ foreach (var (language, _) in LocalizationService.Languages.Where(l => l.Code is not ("en" or "pt-PT" or "pt-BR")))+ data.Add(language, "toolbar");return data;}}@@ -213,6 +215,22 @@ public class PortugueseRenderTestsCapture(window, $"default-{page}-{language}.png");Assert.True(editor.Extent.Width <= editor.Viewport.Width + 1,$"{language}/{page}: horizontal scroll at the default size ({editor.Extent.Width} > {editor.Viewport.Width})");+ if (page == "toolbar")+ {+ foreach (var name in new[] { "NewPresetButton", "NewGroupButton" })+ {+ var button = window.GetVisualDescendants().OfType<Button>().Single(b => b.Name == name);+ var text = button.GetVisualDescendants().OfType<TextBlock>().Single();+ var start = text.TranslatePoint(default, button)!.Value.X;+ Assert.True(start >= 0 && start + text.Bounds.Width <= button.Bounds.Width + 1,+ $"{language}: '{text.Text}' exceeds its action button");+ Assert.All(text.TextLayout.TextLines, line => Assert.False(line.HasCollapsed));+ }+ var loc = AppHost.Get<ILocalizer>();+ var toolbar = (Filee.App.ViewModels.Pages.ToolbarPageViewModel)vm.CurrentPage;+ foreach (var item in toolbar.DonutItems)+ Assert.Equal(loc.DonutName(AppHost.Get<UserDataStore>().FindPreset(item.Id)!), item.Label);+ }}finally{