Localization - Part 2 (#2178)

* Changed language codes in the UI to be a list of all codes we will ever support.

* Converted actionables

* Fixed the GetLocales not using Intersect, but Union.

* Fixed some localization strings in backend when user doesn't exist.

Removed AllowAnonymous from reset-password, since it is a protected API

* Fixed all instances of anonymous APIs where Claim wouldn't work

* Keyed preference options and mixed misc localization issues

* Translations update from Hosted Weblate (#2177)

* Bump versions by dotnet-bump-version.

* Added translation using Weblate (Dutch)

* Bump versions by dotnet-bump-version.

* Translated using Weblate (Dutch)

Currently translated at 20.8% (33 of 158 strings)

Translation: Kavita/backend
Translate-URL: https://hosted.weblate.org/projects/kavita/backend/nl/

* Translated using Weblate (Spanish)

Currently translated at 1.4% (20 of 1371 strings)

Translation: Kavita/ui
Translate-URL: https://hosted.weblate.org/projects/kavita/ui/es/

* Translated using Weblate (Dutch)

Currently translated at 60.1% (95 of 158 strings)

Translation: Kavita/backend
Translate-URL: https://hosted.weblate.org/projects/kavita/backend/nl/

* Translated using Weblate (Dutch)

Currently translated at 60.1% (95 of 158 strings)

Translation: Kavita/backend
Translate-URL: https://hosted.weblate.org/projects/kavita/backend/nl/

* Added translation using Weblate (Dutch)

---------

Co-authored-by: Hans Kalisvaart <hans.kalisvaart@gmail.com>
Co-authored-by: Javier Barbero <javier.agustin.barbero@gmail.com>
Co-authored-by: Stijn <stijn.biemans@gmail.com>

---------

Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Hans Kalisvaart <hans.kalisvaart@gmail.com>
Co-authored-by: Javier Barbero <javier.agustin.barbero@gmail.com>
Co-authored-by: Stijn <stijn.biemans@gmail.com>
This commit is contained in:
Joe Milazzo 2023-08-03 17:51:32 -05:00 committed by GitHub
parent c7701bc729
commit 69532d45ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 2035 additions and 195 deletions

View file

@ -107,7 +107,8 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> GetImage(int chapterId, int page, string apiKey, bool extractPdf = false)
{
if (page < 0) page = 0;
if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
if (userId == 0) return BadRequest();
var chapter = await _cacheService.Ensure(chapterId, extractPdf);
if (chapter == null) return NoContent();
@ -115,7 +116,7 @@ public class ReaderController : BaseApiController
{
var path = _cacheService.GetCachedPagePath(chapter.Id, page);
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path))
return BadRequest(await _localizationService.Translate(User.GetUserId(), "no-image-for-page", page));
return BadRequest(await _localizationService.Translate(userId, "no-image-for-page", page));
var format = Path.GetExtension(path);
return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path), true);
@ -139,7 +140,8 @@ public class ReaderController : BaseApiController
[AllowAnonymous]
public async Task<ActionResult> GetThumbnail(int chapterId, int pageNum, string apiKey)
{
if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
if (userId == 0) return BadRequest();
var chapter = await _cacheService.Ensure(chapterId, true);
if (chapter == null) return NoContent();
var images = _cacheService.GetCachedPages(chapterId);
@ -175,7 +177,7 @@ public class ReaderController : BaseApiController
try
{
var path = _cacheService.GetCachedBookmarkPagePath(seriesId, page);
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest(await _localizationService.Translate(User.GetUserId(), "no-image-for-page", page));
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest(await _localizationService.Translate(userId, "no-image-for-page", page));
var format = Path.GetExtension(path);
return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path));