-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Relating to issue # https://github.com/dotnet/corefx/issues/16985#issuecomment-286142692 #1965
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
Comments
@ryanbrandenburg Loc issue |
It sounds like you're having trouble with resource naming. You seem to have already read https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization but please pay extra attention to the info under "Resource file naming". This kind of problem is usually caused by confusion about namespaces, please double check that the namespace of the class you're creating a resource for is the same as the name of the assembly for your project in the bin folder. For example if your assembly is "Localization.Project.dll" then to get the class If you're still having trouble after double checking your namespace please upload a sample which reproduces your problem to GitHub for us to review and debug against. |
@ryanbrandenburg : yes I read that and named my resource file accordingly. Since I just want to use single .resx common for entire project, I have named it as Startup.resx and my project's name is "app". Can you please give a realistic example of how the naming should be right from the project till .resx file? |
I just dont want to use Controller specific or feature resx... want to have 1 general for now which is for whole project and thats why created it with name after "Startup.cs" which is at root. and the resx file is under /resources folder and /resources folder is also at root of the project. |
Just to clarify, you're saying the namespace of We're trying to clarify the docs in this area because we get a lot of issues filed about it, was there anything specific that made you think to look at the assembly in |
No the namespace of |
Code in
|
Contents of
|
And the way I am trying to use it in my controller which is under "app.api.controllers".
So expected to return the message from .resx file for given key, but it returns not found. |
@deepak-khopade-isdr it would be easier to investigate this if you could distill your project into the smallest project that still demonstrates the behavior. That said, I notice that in your For reference on how we recommend people use Localization within an MVC project see this projects in Entropy. Thanks for bringing that up, I think I'll go ahead and add that to the Localization readme to make it more discoverable. |
My controller code below. And I havent implemented it project wide yet and was trying on this first simple controller, however, its not working. I will put everything in order in next comment.
And then simply using |
You're creating an |
Ok, tried the way you explained but no luck :( |
Please create a GitHub repo which reproduces your problem and link to it here so that I have something to examine. |
Alright... here you go: https://github.com/deepak-khopade-isdr/LocalizationWebApi However, important to mention here. When I ran this on my local (Ubuntu 16.04 and JetBrains Rider IDE) it's working, but when I took the same code on "docker" container, it's not working. Not working meaning, it's not loading the value from a .RESX file I am expecting. Please run this on docker container to reproduce the error. Also please let me know the if I am using this Localization feature incorrectly. |
Guess what, when I tried my regular app (business app in our private repo) running locally (not in docker), it's working, so looks like something wrong when .NET Core is trying to read the Resource file(s) from mounted systems / drives. Not sure, but my strong guess. Or may be when dealing with resx files on docker containers, I am doing something wrong. |
What does you DockerFile look like? I ask because if you're doing something like If you're publishing your project and then doing |
Sorry I didn't get you completely; what is docker file and where can i find it in my project? |
A DockerFile is a file you would create so that other people and systems can reliably create docker images identical to the ones you're producing locally, and thus have the same experience as you (anyone feel free to correct me, I'm new to docker). If you do not have one I think the best course of action would be for you to add |
Hi @ryanbrandenburg, Sorry for late reply on this. We don't have project.json anymore and using .csporj now for all our projects in solution so that we can mix our developer environment with Windows, Ubuntu & MAC. And also to use either VS 2017 CE or Jet Brains Rider.
And for dockerfile I now get what you say but I dont have persmission to share the docker file. I will check with our DevOps engineer if he can give me details about it. |
Just FYI: I was reading about Docker Containers and Volumes. And in our project, we are using volume which is obviously a shared file system folder from host OS into Docker container. And when I am running project on Host OS locally (Ubuntu or Windows) using F5 http://localhost:5000/... its working and when running under docker using http://dockerhost:/... its failing; |
This issue was moved to aspnet/Localization#357 |
…s runs our scenarios (#1965)
Allow PR builds to flow
Please refer: https://github.com/dotnet/corefx/issues/16985#issuecomment-286142692
The text was updated successfully, but these errors were encountered: