mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-29 03:30:43 +12:00
Localize the Type summary in History window title
- Create ResX entries for EDataType ENUM - Implement a lookup dictionary: enum string value => translation string - Query the lookup with strings found in history file Thanks OMGasm
This commit is contained in:
parent
d2f8aa1517
commit
d71b805feb
45
ShareX.HelpersLib/Properties/Resources.Designer.cs
generated
45
ShareX.HelpersLib/Properties/Resources.Designer.cs
generated
|
@ -903,6 +903,51 @@ internal class Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Default.
|
||||
/// </summary>
|
||||
internal static string EDataType_Default {
|
||||
get {
|
||||
return ResourceManager.GetString("EDataType_Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File.
|
||||
/// </summary>
|
||||
internal static string EDataType_File {
|
||||
get {
|
||||
return ResourceManager.GetString("EDataType_File", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Image.
|
||||
/// </summary>
|
||||
internal static string EDataType_Image {
|
||||
get {
|
||||
return ResourceManager.GetString("EDataType_Image", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Text.
|
||||
/// </summary>
|
||||
internal static string EDataType_Text {
|
||||
get {
|
||||
return ResourceManager.GetString("EDataType_Text", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to URL.
|
||||
/// </summary>
|
||||
internal static string EDataType_URL {
|
||||
get {
|
||||
return ResourceManager.GetString("EDataType_URL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error.
|
||||
/// </summary>
|
||||
|
|
|
@ -1373,4 +1373,19 @@ Would you like to download and install it?</value>
|
|||
<data name="URLSharingServices_BingVisualSearch" xml:space="preserve">
|
||||
<value>Bing visual search</value>
|
||||
</data>
|
||||
<data name="EDataType_Default" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="EDataType_File" xml:space="preserve">
|
||||
<value>File</value>
|
||||
</data>
|
||||
<data name="EDataType_Image" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="EDataType_Text" xml:space="preserve">
|
||||
<value>Text</value>
|
||||
</data>
|
||||
<data name="EDataType_URL" xml:space="preserve">
|
||||
<value>URL</value>
|
||||
</data>
|
||||
</root>
|
|
@ -256,10 +256,15 @@ private void UpdateTitle(HistoryItem[] historyItems = null)
|
|||
status.AppendFormat(" - " + Resources.HistoryForm_UpdateItemCount___Filtered___0_, historyItems.Length.ToString("N0"));
|
||||
}
|
||||
|
||||
string[] typeNames = Enum.GetNames(typeof(EDataType));
|
||||
string[] typeTranslations = Helpers.GetLocalizedEnumDescriptions<EDataType>();
|
||||
Dictionary<string, string> lookup = Enumerable.Zip(typeNames, typeTranslations, (key, val) => new { key, val } )
|
||||
.ToDictionary(e => e.key, e => e.val);
|
||||
|
||||
IEnumerable<string> types = historyItems.
|
||||
GroupBy(x => x.Type).
|
||||
OrderByDescending(x => x.Count()).
|
||||
Select(x => string.Format(" - {0}: {1}", x.Key, x.Count()));
|
||||
Select(x => string.Format(" - {0}: {1}", lookup.TryGetValue(x.Key, out string value) ? value : x.Key, x.Count()));
|
||||
|
||||
foreach (string type in types)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue