-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AmbiguousActionException when using services.AddMvc().AddXDbLocalizer<TDbContext, TTranslator>() #22
Comments
Hi @morgrowe , glad to see you again :) For MVC you need to add public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
[Route("")]
public IActionResult Index()
{
return View();
}
[Route("Privacy")]
public IActionResult Privacy()
{
return View();
}
} |
Hi Ziya Thank you, as always, for your quick response. Adding the Route decorators fixed that issue. :) I have one final problem and I can't for the life of me figure out what's doing on. I have seeded by database with the cultures and some dummy resources: It doesn't seem to be localizing strings unless the culture is set to my secondary one: However, if I go to Any idea what's going on there? I bet I've misconfigured something in my Cheers |
I see! That makes sense. I agree it's not a bug, but it would be great to add the option mentioned in #19 to support key codes. I look forward to the update. :) Thanks |
Hi @morgrowe , BR, |
And for DB version update to XLocalizer.DB v1.0.2 |
Brilliant, thanks Ziya :) |
Hi Ziya,
Hope you're well.
I've successfully added XLocalizer.DB to a RazorPages project, but I'm having issues adding it to an existing Mvc project. Despite changes I've tried to make, I either get the 'AmbiguousActionException' exception or the route localization doesn't work at all. It's a very simple project with only one controller.
Here's the Startup.cs:
And the
Index
method in theHomeController
is very straight forward:I've got the exception to go away by removing:
and
and updating my
MapRoute
to:But doing this ignores the culture in the URL--it always returns "en", even if "cy" is in the URL.
Any guidance would be really appreciated. I'm more than likely doing something silly again.
Cheers
Morgan
The text was updated successfully, but these errors were encountered: