The features are greatly inspired by another screen annotation software Epic Pen, but even more easy to use. Add the preferred language (Tamil in this article) from the dropdown and use the Move Up button to make it as first preference.ĭownload the source and see it in action.GInk is an on-screen annotation software under Windows, used to help improving my presentations and demonstrations, and to help working on temperary thoughts which need to be noted beside something on the screen. To make the browser add the language header, in Firefox, go to Tools>Options>Content. Protected void Application_AcquireRequestState(object sender, EventArgs e) I have set the current UI thread’s culture from Global.asax file by accepting the Request object’s language header set by the client browser. When executed, you can see the title changed to Tamil when the current UI thread culture is set to Tamil. The Tamil resource file will look like below. Refer here to know the list of language-country code.
Doing this will make the resource file to get picked automatically when the current UI thread culture is set to culture code ta-IN. The file name must include language code ta for Tamil as part of the name (EmployeeResx. Add a new resource file and name it as EmployeeResx.ta.resx. Now, let’s add another resource file for adding support for another language, for example, Tamil. Change it to Public in the Access Modifier dropdown in the resource file toolbar. This is because, by default the resource file properties have access modifier set to internal. Type 'Xxxx.EmployeeResx' is not public or does not contain a public static string property with the name 'FirstName'.“. Note: You may get an error “Cannot retrieve property 'Name' because localization failed. When executed, you can see the display title coming from the resource file like below. The Name should match the value defined for Name parameter in Display attribute. Next, we need to add the key-value pair for all the Employee properties in the added resource file like below. Now, let’s add display attribute to the properties of Employee object and configure it to look for the display title in EmployeeResx.resx file. I have added the file under Models/RESX folder in my solution. Rename the file name to EmployeeResx.resx and Click Add. In the Add New Item dialogue, select “Resources File” under General category. To add a resource file into your solution, right click project in solution explorer and click Add > New Item. The project requires all the Nuget packages required for Asp.Net MVC 5.0 and the latest Entity Framework package included in the solution.Ĭreating Resource File and Configuring Model Class The Display attribute already includes supports reading from resource file through a parameter called ResourceType.įor demonstration, we will use a simple Employee-Department model with Entity Framework Code First and Asp.Net MVC 5.0 solution using Visual Studio 2015. This simple article will help us to manage the display titles using resource files with multi language support in an Asp.Net MVC application. It also helps in localization of display attributes. By using resource file, it will be easier to change the display name instead changing the C# class file. The value defined in this attribute will be used by the html helper => model.FirstName)) to display the title for the field.Īt times, it would be helpful if we can provide resource files to define the display title instead of hard coding inside the attribute. One such attribute is DisplayAttribute which is used to define the display title for the field. This Meta data defined using these attributes will be used by Entity Framework for model generation and Asp.Net MVC framework for validations and scaffolding UI components, etc. We use the attributes defined in namespace to supply meta data for model classes.