Questions tagged [resx]

.resx files are resource lists used in .NET applications.

ResX Resource Files are used in .net applications for translating applications into several languages. Each language has its own file, e.g. a file "Default.aspx" could have a resx-file "Default.aspx.de.resx" for german translation and "Default.aspx.fr.resx" for french translation. Default translation is english language and results in file "Default.aspx.resx" without any language code. See Microsoft Documentation for details.

1010 questions
168
votes
6 answers

DisplayName attribute from Resources?

I have a localized application, and I am wondering if it is possible to have the DisplayName for a certain model property set from a Resource. I'd like to do something like this: public class MyModel { [Required] …
Palantir
  • 23,820
  • 10
  • 76
  • 86
106
votes
5 answers

Carriage Return/Line Feed in .Net Resource File (App_GlobalResources)

I'm keeping several texts in an App_GlobalResources.resx file. The texts have to be multi-line and I need to have them contain line feeds. However, when I read the contents, all line feeds are gone (\r\n is printed, not as CRLF 10 13 control…
Alex
  • 75,813
  • 86
  • 255
  • 348
88
votes
5 answers

What are the benefits of resource(.resx) files?

What compelling reasons exist for using them?
Newbie
  • 7,031
  • 9
  • 60
  • 85
76
votes
7 answers

Get values from *.resx files in XAML

Is it possible to add some value from resource file right into the XAML markup? Or for localization we always have to make something like this in *.cs file: txtMessage.Text = Messages.WarningUserMessage; Where Messages is resource, and txtMessage…
0x49D1
  • 8,505
  • 11
  • 76
  • 127
58
votes
5 answers

Changing Resource files (resx) namespace and access modifier

In my webproject I'm using 4 resources files in my App_GlobalResources folder. One of them (lang.resx) has been created before my arrival on the project. It has the correct namespace (WebApplication.App_GlobalResources) and access modifier :…
Michael Pereira
  • 1,263
  • 1
  • 17
  • 28
43
votes
4 answers

Visual Studio : can't find "resource file" in list of items to add to project

I'm on VS Community 2017 RC. I'd like to add a resource file (.resx) to my project but this item type is not listed in the items Have I missed something ? Do I need to install anything on top of my Visual Studio to be able to manage resource files ?
bob
  • 774
  • 1
  • 7
  • 16
43
votes
12 answers

Localize Strings in Javascript

I'm currently using .resx files to manage my server side resources for .NET. the application that I am dealing with also allows developers to plugin JavaScript into various event handlers for client side validation, etc.. What is the best way for me…
SaaS Developer
  • 9,835
  • 7
  • 34
  • 45
40
votes
1 answer

Localization in WPF

I am starting a new application in WPF and I am curious how to handle Localization? In WinForms you can use resx strings for the UI text, how is this done in WPF? Is there a special binding syntax for binding to resx resources or is there a…
Lukasz
  • 8,710
  • 12
  • 44
  • 72
40
votes
8 answers

Adding new strings to resource.resx not reflecting into Designer.cs

I am adding two new strings to our resource.resx but these newly added resources(strings) are not reflecting into the auto-generated Designer.cs file. I have rebuilt the project and also tried clean+build the project but no luck! I have other…
sandy
  • 616
  • 2
  • 9
  • 20
38
votes
4 answers

Global resource vs. Local resource in ASP.NET

We use resx files to localize our web applications. We usually create local resx files (that map to a specific page) when only one page uses a certain phrase, and a global resx file when more than one page needs the phrase. But the good thing about…
Lea Cohen
  • 7,990
  • 18
  • 73
  • 99
37
votes
5 answers

.resx vs database vs custom solution for providing Localization/Globalization

At my office, we have had a long-standing debate about Localization/Globalization and how to handle it. One side pushes for the Resource (.resx) file route built in to ASP.NET, one side pushes for a database driven solution. A third group believes…
trelston
  • 633
  • 1
  • 5
  • 13
37
votes
3 answers

Best practice for ASP.NET MVC resource files

What are the best usage of the following resource files. Properties → Resources (Phil used this resource for localization in DataAnnotation) App_GlobalResources folder App_LocalResources folder I also would like to know what is the difference…
Soe Moe
  • 3,428
  • 1
  • 23
  • 32
35
votes
6 answers

Create designer.cs file from ResXRersourcewriter generated resource file

I got a programm that generates .resx resource files. Those resource files are used in other projects, that isnt in the same solution as the project that generates the resource files. I wonder now, if its possible to generate a designer.cs file from…
JayTee
  • 1,114
  • 2
  • 11
  • 18
35
votes
1 answer

How can I open a resx file in Visual Studio XML editor by default?

I want the 'View Code' view by default (xml editor), so that I can use features in R# File Structure window.
JoeB
  • 2,743
  • 6
  • 38
  • 51
34
votes
3 answers

Should Resources.Designer.cs be under source control?

I have Resources.resx, which is used to generate Resources.designer.cs. Should Resources.designer.cs be checked in, or can I rely on Visual Studio generating it when required?
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
1
2 3
67 68