Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda is not recognizing the culture on .net core

I'm developing a simple lambda function with .net core. For this, I'm using the AWS tookit.

My project have a three resources file, one with default message, and two with italian and french greetings.

For this, my function receive a query string parameter, and depending on this value, I set the culture for the current thread.

If I run this project with the unit test project, all works fine, but when is run on amazon infraestructure, it shown the default message. It's like if never changes the default culture of the main thread.

I'm changing the current culture like this:

CultureInfo.CurrentCulture = new CultureInfo("fr");
CultureInfo.CurrentUICulture = new CultureInfo("fr");

You can also test from this url, that point to an api gateway endpoint, that utilize my lambda function; where language 1 is french, 2 is italian and another value is unsuported language.

I created an example project on github to reproduce this behavior

Any idea on how to fix thit? I want to send localized message from my API, Maybe another approach?

Thanks a lot!

UPDATE

In AWS Forum, says that resources is not supported yet! I created an issue in github AWS repo.

like image 963
Vladimir Venegas Avatar asked Nov 08 '22 23:11

Vladimir Venegas


1 Answers

From normj response:

You could check it on This is now fixed in the new .NET Core 2.0 Lambda runtime that was released today, https://aws.amazon.com/blogs/developer/aws-lambda-net-core-2-0-support-released/

like image 122
Vladimir Venegas Avatar answered Nov 14 '22 22:11

Vladimir Venegas