This commit is contained in:
LotP1
2024-12-26 19:54:02 +01:00
parent 1bac6ab19e
commit 8c0a82bb6e
5 changed files with 63 additions and 58 deletions

View File

@@ -1,22 +1,17 @@
using System;
using Microsoft.Build.Utilities;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.Json;
using Microsoft.Build.Framework;
using System.Text.Encodings.Web;
namespace Ryujinx.BuildValidationTasks
{
public class LocalesValidationTask : Task
public class LocalesValidationTask : ValidationTask
{
public string Path { get; set; }
public override bool Execute()
public static bool Execute(string projectPath)
{
string path = Path;
string path = projectPath + "src\\Ryujinx\\Assets\\locales.json";
string data;
using (StreamReader sr = new(path))
@@ -34,7 +29,7 @@ namespace Ryujinx.BuildValidationTasks
}
catch (Exception e)
{
Log.LogError($"Json Validation failed! {e.Message}");
//Log.LogError($"Json Validation failed! {e.Message}");
return false;
}
@@ -47,7 +42,7 @@ namespace Ryujinx.BuildValidationTasks
foreach (string langCode in json.Languages.Where(it => !locale.Translations.ContainsKey(it)))
{
locale.Translations.Add(langCode, string.Empty);
Log.LogMessage(MessageImportance.High, $"Added '{langCode}' to Locale '{locale.ID}'");
//Log.LogMessage(MessageImportance.High, $"Added '{langCode}' to Locale '{locale.ID}'");
}
locale.Translations = locale.Translations.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => pair.Value);