Change Localize endpoint to use route parameter for key

The Localize endpoint in TestLocalizerController now accepts the "key" parameter as a route parameter instead of a query string. The method signature was updated to use [FromRoute], and the route template was modified to include "{key}". This changes the endpoint usage from /localize?key=de_DE to /localize/de_DE.
This commit is contained in:
2026-02-12 16:42:49 +01:00
parent cdca639e4f
commit aaf1f75aa7

View File

@@ -23,8 +23,8 @@ namespace EnvelopeGenerator.Web.Controllers.Test
_cultures = cultures;
}
[HttpGet]
public IActionResult Localize([FromQuery] string key = "de_DE") => Ok(_localizer[key]);
[HttpGet("{key}")]
public IActionResult Localize([FromRoute] string key) => Ok(_localizer[key]);
[HttpGet("fi-class")]
public IActionResult GetFIClass(string? lang = null) => lang is null ? Ok(_cultures.FIClasses) : Ok(_cultures[lang]?.FIClass);