Localization Issues (#3653)

Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
Joe Milazzo 2025-03-19 07:08:12 -05:00 committed by GitHub
parent 98a2b9d3ed
commit 0f72f63b35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 25 additions and 21 deletions

View file

@ -695,7 +695,7 @@ public class BookService : IBookService
var month = 0;
var day = 0;
if (string.IsNullOrEmpty(publicationDate)) return (year, month, day);
switch (DateTime.TryParse(publicationDate, out var date))
switch (DateTime.TryParse(publicationDate, CultureInfo.InvariantCulture, out var date))
{
case true:
year = date.Year;

View file

@ -70,7 +70,6 @@ public class FileService : IFileService
// Compute SHA hash
var checksum = SHA256.HashData(Encoding.UTF8.GetBytes(content));
return BitConverter.ToString(checksum).Replace("-", string.Empty).Equals(sha);
return Convert.ToHexString(checksum).Equals(sha);
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
@ -1167,18 +1168,18 @@ public class ScrobblingService : IScrobblingService
var value = tokens[index];
if (typeof(T) == typeof(int?))
{
if (int.TryParse(value, out var intValue))
if (int.TryParse(value, CultureInfo.InvariantCulture, out var intValue))
return (T)(object)intValue;
}
else if (typeof(T) == typeof(int))
{
if (int.TryParse(value, out var intValue))
if (int.TryParse(value, CultureInfo.InvariantCulture, out var intValue))
return (T)(object)intValue;
return default;
}
else if (typeof(T) == typeof(long?))
{
if (long.TryParse(value, out var longValue))
if (long.TryParse(value, CultureInfo.InvariantCulture, out var longValue))
return (T)(object)longValue;
}
else if (typeof(T) == typeof(string))
@ -1187,7 +1188,7 @@ public class ScrobblingService : IScrobblingService
}
}
return default(T?);
return default;
}
/// <summary>

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@ -538,13 +539,13 @@ public class ReadingListService : IReadingListService
var maxPairs = Math.Max(arcs.Length, arcNumbers.Length);
for (var i = 0; i < maxPairs; i++)
{
var arcNumber = int.MaxValue.ToString();
var arcNumber = int.MaxValue.ToString(CultureInfo.InvariantCulture);
if (arcNumbers.Length > i)
{
arcNumber = arcNumbers[i];
}
if (string.IsNullOrEmpty(arcs[i]) || !int.TryParse(arcNumber, out _)) continue;
if (string.IsNullOrEmpty(arcs[i]) || !int.TryParse(arcNumber, CultureInfo.InvariantCulture, out _)) continue;
data.Add(new Tuple<string, string>(arcs[i], arcNumber));
}

View file

@ -782,7 +782,7 @@ public class ProcessSeries : IProcessSeries
chapter.SortOrder = info.IssueOrder;
}
if (float.TryParse(chapter.Title, out _))
if (float.TryParse(chapter.Title, CultureInfo.InvariantCulture, out _))
{
// If we have float based chapters, first scan can have the chapter formatted as Chapter 0.2 - .2 as the title is wrong.
chapter.Title = chapter.GetNumberTitle();

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
@ -253,7 +254,7 @@ public partial class VersionUpdaterService : IVersionUpdaterService
{
Version = version,
PrNumber = prNumber,
Date = DateTime.Parse(commit.Commit.Author.Date)
Date = DateTime.Parse(commit.Commit.Author.Date, CultureInfo.InvariantCulture)
});
}
}