mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
Localization Issues (#3653)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
parent
98a2b9d3ed
commit
0f72f63b35
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -2080,7 +2081,7 @@ public class SeriesServiceTests : AbstractDbTest
|
||||
public async Task GetEstimatedChapterCreationDate_NextChapter_ChaptersMonthApart()
|
||||
{
|
||||
await ResetDb();
|
||||
var now = DateTime.Parse("2021-01-01"); // 10/31/2024 can trigger an edge case bug
|
||||
var now = DateTime.Parse("2021-01-01", CultureInfo.InvariantCulture); // 10/31/2024 can trigger an edge case bug
|
||||
|
||||
_context.Library.Add(new LibraryBuilder("Test LIb")
|
||||
.WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -35,7 +36,7 @@ public static class MigrateInitialInstallData
|
||||
{
|
||||
var fi = directoryService.FileSystem.FileInfo.New(dbFile);
|
||||
var setting = settings.First(s => s.Key == ServerSettingKey.FirstInstallDate);
|
||||
setting.Value = fi.CreationTimeUtc.ToString();
|
||||
setting.Value = fi.CreationTimeUtc.ToString(CultureInfo.InvariantCulture);
|
||||
await dataContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public static class FilterFieldValueConverter
|
||||
.ToList(),
|
||||
FilterField.WantToRead => bool.Parse(value),
|
||||
FilterField.ReadProgress => string.IsNullOrEmpty(value) ? 0f : value.AsFloat(),
|
||||
FilterField.ReadingDate => DateTime.Parse(value),
|
||||
FilterField.ReadingDate => DateTime.Parse(value, CultureInfo.InvariantCulture),
|
||||
FilterField.ReadLast => int.Parse(value),
|
||||
FilterField.Formats => value.Split(',')
|
||||
.Select(x => (MangaFormat) Enum.Parse(typeof(MangaFormat), x))
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
|
||||
@ -19,7 +20,7 @@ public static class JwtHelper
|
||||
var token = jwtHandler.ReadJwtToken(jwtToken);
|
||||
var exp = token.Claims.FirstOrDefault(c => c.Type == "exp")?.Value;
|
||||
|
||||
if (long.TryParse(exp, out var expSeconds))
|
||||
if (long.TryParse(exp, CultureInfo.InvariantCulture, out var expSeconds))
|
||||
{
|
||||
return DateTimeOffset.FromUnixTimeSeconds(expSeconds).UtcDateTime;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class PdfComicInfoExtractor : IPdfComicInfoExtractor
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return null;
|
||||
|
||||
if (float.TryParse(text, out var value)) return value;
|
||||
if (float.TryParse(text, CultureInfo.InvariantCulture, out var value)) return value;
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -58,7 +58,7 @@ public class PdfComicInfoExtractor : IPdfComicInfoExtractor
|
||||
|
||||
// Dates stored in the XMP metadata stream (PDF Spec 14.3.2)
|
||||
// are stored in ISO 8601 format, which is handled by C# out of the box
|
||||
if (DateTime.TryParse(text, out var date)) return date;
|
||||
if (DateTime.TryParse(text, CultureInfo.InvariantCulture, out var date)) return date;
|
||||
|
||||
// Dates stored in the document information directory (PDF Spec 14.3.3)
|
||||
// are stored in a proprietary format (PDF Spec 7.9.4) that needs to be
|
||||
@ -71,7 +71,7 @@ public class PdfComicInfoExtractor : IPdfComicInfoExtractor
|
||||
|
||||
foreach(var format in _pdfDateFormats)
|
||||
{
|
||||
if (DateTime.TryParseExact(text, format, null, System.Globalization.DateTimeStyles.None, out var pdfDate)) return pdfDate;
|
||||
if (DateTime.TryParseExact(text, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out var pdfDate)) return pdfDate;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
<Product>Kavita</Product>
|
||||
<AssemblyVersion>0.8.5.11</AssemblyVersion>
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<TieredPGO>true</TieredPGO>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -129,7 +129,7 @@ export class ManageUserPreferencesComponent implements OnInit {
|
||||
this.fontFamilies = this.bookService.getFontFamilies().map(f => f.title);
|
||||
this.cdRef.markForCheck();
|
||||
|
||||
this.localizationService.locales$.subscribe(res => {
|
||||
this.localizationService.getLocales().subscribe(res => {
|
||||
this.locales = res;
|
||||
|
||||
this.cdRef.markForCheck();
|
||||
|
Loading…
x
Reference in New Issue
Block a user