in Tools/CheckResourceStrings/CheckResourceStrings/Program.cs [11:54]
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Path to root of the template artifacts missing");
}
string templateJsonLocation = Path.Combine(args[0], "templates", "templates.json");
Helper.CheckJsonFilePath(templateJsonLocation);
string bindingJsonLocation = Path.Combine(args[0], "bindings", "bindings.json");
Helper.CheckJsonFilePath(bindingJsonLocation);
var resoucesStringNames = Helper.GetResourceStringNames(templateJsonLocation);
resoucesStringNames.AddRange(Helper.GetResourceStringNames(bindingJsonLocation));
string resourcesLocation = Path.Combine(args[0], "resources");
string defaultResourceFilePath = Path.Combine(resourcesLocation, $"Resources.json");
Helper.CheckJsonFilePath(defaultResourceFilePath);
var content = File.ReadAllText(defaultResourceFilePath);
var resourceStrings = JsonConvert.DeserializeObject<ResourceStringsObj>(content);
PrintMissingResourceStrings(resourceStrings.EnglishResourceMap, resoucesStringNames, defaultResourceFilePath);
if (args.Length > 1 && bool.TryParse(args[1], out bool checkAllLocales) && checkAllLocales)
{
defaultResourceFilePath = Path.Combine(resourcesLocation, $"Resources.en-US.json");
Helper.CheckJsonFilePath(defaultResourceFilePath);
content = File.ReadAllText(defaultResourceFilePath);
resourceStrings = JsonConvert.DeserializeObject<ResourceStringsObj>(content);
PrintMissingResourceStrings(resourceStrings.EnglishResourceMap, resoucesStringNames, defaultResourceFilePath);
foreach (var locale in FunctionsConstants.Locales)
{
string resourceFilePath = Path.Combine(resourcesLocation, $"Resources.{locale}.json");
Helper.CheckJsonFilePath(resourceFilePath);
var fileContent = File.ReadAllText(resourceFilePath);
var bundleresourceStrings = JsonConvert.DeserializeObject<ResourceStringsObj>(fileContent);
PrintMissingResourceStrings(bundleresourceStrings.LanguageResourceMap, resoucesStringNames, resourceFilePath);
}
}
Console.ReadLine();
}