Explorar el Código

Remove unused `FirstCharToLower` method from `StringExtensions` and update `File.Value` to capitalize the first character directly.

Ruben hace 3 meses
padre
commit
590b382787

+ 0 - 15
src/PicView.Core/Extensions/StringExtensions.cs

@@ -7,21 +7,6 @@ namespace PicView.Core.Extensions;
 /// </summary>
 public static partial class StringExtensions
 {
-    /// <summary>
-    /// Converts the first character of the string to lowercase.
-    /// </summary>
-    /// <param name="input">The input string.</param>
-    /// <returns>A string with the first character capitalized. If the string is null or empty, an empty string is returned.</returns>
-    public static string FirstCharToLower(this string input)
-    {
-        return input switch
-        {
-            null => string.Empty,
-            "" => string.Empty,
-            _ => string.Concat(input[0].ToString().ToLower(), input.AsSpan(1))
-        };
-    }
-
     /// <summary>
     /// Shortens the given string <paramref name="name"/> to the specified <paramref name="amount"/> and appends "..." to it.
     /// </summary>

+ 4 - 3
src/PicView.Core/ViewModels/TranslationViewModel.cs

@@ -1,4 +1,5 @@
-using PicView.Core.Localization;
+using PicView.Core.Extensions;
+using PicView.Core.Localization;
 using R3;
 
 namespace PicView.Core.ViewModels;
@@ -13,8 +14,8 @@ public class TranslationViewModel : IDisposable
     public void UpdateLanguage()
     {
         var t = TranslationManager.Translation;
-        
-        File .Value = t.File;
+
+        File.Value = string.Concat(t.File[0].ToString().ToUpper(), t.File.AsSpan(1));
         SelectFile .Value = t.OpenFileDialog;
         OpenLastFile .Value = t.OpenLastFile;
         Paste .Value = t.FilePaste;