Parcourir la source

Improved localization key show modes

CPKreuz il y a 1 an
Parent
commit
5edd7e2df9

+ 6 - 1
src/PixiEditor.Extensions/Common/Localization/LocalizationKeyShowMode.cs

@@ -20,5 +20,10 @@ public enum LocalizationKeyShowMode
     /// <summary>
     /// Shows a long string ensuring responsive layout
     /// </summary>
-    LALALA,
+    LAGLAGLAG,
+    
+    /// <summary>
+    /// Shows a short string ensuring responsive layout
+    /// </summary>
+    Short
 }

+ 4 - 2
src/PixiEditor.Extensions/Common/Localization/LocalizedString.cs

@@ -16,9 +16,11 @@ public struct LocalizedString
             #else
             Value = OverridenKeyFlowMode switch
             {
+                LocalizationKeyShowMode.Value => GetValue(value),
                 LocalizationKeyShowMode.Key => Key,
                 LocalizationKeyShowMode.ValueKey => $"{GetValue(value)} ({Key})",
-                LocalizationKeyShowMode.LALALA => $"#~{GetLongString(GetValue(value).Count(x => x == ' ') + 1)}{Math.Abs(Key.GetHashCode()).ToString()[..2]}~#",
+                LocalizationKeyShowMode.LAGLAGLAG => $"#~{GetLongString(GetValue(value).Count(x => x == ' ') + 1)}{Math.Abs(Key.GetHashCode()).ToString()[..2]}~#",
+                LocalizationKeyShowMode.Short => "L",
                 _ => GetValue(value)
             };
             #endif
@@ -73,7 +75,7 @@ public struct LocalizedString
         return ApplyParameters(ILocalizationProvider.Current.CurrentLanguage.Locale[localizationKey]);
     }
 
-    private string GetLongString(int length) => string.Join(' ', Enumerable.Repeat("LaLaLaLaLa", length));
+    private string GetLongString(int length) => string.Join(' ', Enumerable.Repeat("LagLagLaag", length));
 
     private string ApplyParameters(string value)
     {