mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Add translation completeness info
This commit is contained in:
@@ -36,6 +36,7 @@ using ArchiSteamFarm.Localization;
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class ASF {
|
||||
private const byte AutoUpdatePeriodInHours = 24;
|
||||
|
||||
private static readonly ConcurrentDictionary<Bot, DateTime> LastWriteTimes = new ConcurrentDictionary<Bot, DateTime>();
|
||||
|
||||
private static Timer AutoUpdatesTimer;
|
||||
|
||||
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
@@ -1233,6 +1233,15 @@ namespace ArchiSteamFarm.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ASF will attempt to use your preferred {0} culture, but translation in that language was completed only in {1}. Perhaps you could help us improve ASF translation for your language?.
|
||||
/// </summary>
|
||||
internal static string TranslationIncomplete {
|
||||
get {
|
||||
return ResourceManager.GetString("TranslationIncomplete", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unknown command!.
|
||||
/// </summary>
|
||||
|
||||
@@ -693,4 +693,8 @@ StackTrace:
|
||||
<data name="ErrorInvalidCurrentCulture" xml:space="preserve">
|
||||
<value>Your provided CurrentCulture is invalid, ASF will keep running with default one!</value>
|
||||
</data>
|
||||
<data name="TranslationIncomplete" xml:space="preserve">
|
||||
<value>ASF will attempt to use your preferred {0} culture, but translation in that language was completed only in {1}. Perhaps you could help us improve ASF translation for your language?</value>
|
||||
<comment>{0} will be replaced by 4-letter culture code, such as "en-US", {1} will be replaced by completeness percentage, such as "78.5%"</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -29,6 +29,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -221,6 +222,24 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
int defaultResourceSetCount = 0;
|
||||
int currentResourceSetCount = 0;
|
||||
|
||||
ResourceSet defaultResourceSet = Strings.ResourceManager.GetResourceSet(CultureInfo.CreateSpecificCulture("en-US"), true, true);
|
||||
if (defaultResourceSet != null) {
|
||||
defaultResourceSetCount = defaultResourceSet.Cast<object>().Count();
|
||||
}
|
||||
|
||||
ResourceSet currentResourceSet = Strings.ResourceManager.GetResourceSet(CultureInfo.CurrentCulture, true, false);
|
||||
if (currentResourceSet != null) {
|
||||
currentResourceSetCount = currentResourceSet.Cast<object>().Count();
|
||||
}
|
||||
|
||||
if ((currentResourceSetCount < defaultResourceSetCount) && (defaultResourceSetCount > 0)) {
|
||||
float translationCompleteness = currentResourceSetCount / (float) defaultResourceSetCount;
|
||||
ArchiLogger.LogGenericInfo(string.Format(Strings.TranslationIncomplete, CultureInfo.CurrentCulture.Name, translationCompleteness.ToString("P1")));
|
||||
}
|
||||
|
||||
string globalDatabaseFile = Path.Combine(SharedInfo.ConfigDirectory, SharedInfo.GlobalDatabaseFileName);
|
||||
|
||||
if (!File.Exists(globalDatabaseFile)) {
|
||||
|
||||
Reference in New Issue
Block a user