It is possible to localize all login pages and all text fields related to the login process. In other words, all page texts and error messages for the Identify*Runtime application can be changed – not only in regards of adding new languages but also replacing them. This section will explain in details what you need to do in order to localize Identify*Runtime.
Although it is possible for non-technical staff to operate, more often than not, the technical member will probably be involved in the process, so we will here go a bit more into details in regards to the technical details of how localization works.
- All text resources are placed in resx files.
- Existing text resource files can be edited and new ones can be added without a need to recompile the code.
- If a text resource is not found in a specific language it will fall back to the text resource of the default language. If your selected default language is missing a value for the text resource, it will fall back to the Danish language resource.
- The default language is configurable.
Locating and editing the text resource files
Finding the text resource files is easy, since they are all located in the same folder. Basically you will have to open the installed code base for Identify*Runtime and look for the resx files in the Tenants\[Tenantname]\Runtime\App_GlobalResources folder.
Each plugin will have its own set of resource files. E.g. DeviceBased plugin will have the files:
- For this plugin, you can see that there are two resource files (.resx files). The default file (DeviceBasedResources.resx) is in Danish. The English version contains an 'en' term in the middle (DeviceBasedResources.en.resx).
- To add another language, simply copy one of these two mentioned file and give it a middle section that identifies the language you are adding, for example, 'de' term can be used to indicate that the text resource is in German. You can find the list of language abbreviations here: http://msdn.microsoft.com/en-us/library/cc233965.aspx. It is important that you use the correct abbreviations since these will interact with the client’s chosen browser language (accept-language) in order to present him with the correct language. If the user’s chosen language is not available among the offered resource files, it will fall back to your selected default language.
- A good tool for editing resource files can be found here: http://www.codeproject.com/Articles/16068/Zeta-Resource-Editor
- Please note that every time the App_GlobalResources is changed, Identify*Runtime will restart. This is the default behavior of ASP.NET. This may cause some conveniences for users who are in the process of logging in, so you should operate this task when not in heavy traffic.
Client-only text resources
A client may want to have their own localized texts on some views, for example some greeting messages. To do this, simply:
- Add a new text to all relevant resource files.
- To read the string from these resource files, e.g. from UserNamePasswordResources, insert into the page the following command: Resources.UserNamePasswordResources.ResourceManager.GetString(keyname_here)
Changing default language and overriding text resources
Although the system by default is set up to use Danish as the default language, you can easily change this. Simply find the web.config file of the tenant in question and change the DefaultLanguage key to your preferred language. E.g. <add key="DefaultLanguage" value="en-US"/>.
While you are free to edit all resources, it may not always be the best thing to do. If you upgraded your tenant to a newer version then the languages that by default are supported by Safewhere*Identify will be overwritten. There is although an alternative to change the existing language files, namely “override”.
To use the override function, you need to follow the instruction below:
- Specify a value for the ClientName key in web.config, e.g. “YourCompany”. E.g. <add key="ClientName" value="YourCompany"/>.
- Given that the text to override is in the UserNamePasswordResources.resx file, clone this file and name it UserNamePasswordResources_YourCompany.resx, remove all texts except those that will be overridden. If you want to override texts for e.g. Spanish, name it UserNamePasswordResources_YourCompany.es.resx. Please note that the neutral file, which is UserNamePasswordResources_YourCompany.resx must always exist, although it may contain no resources at all.
- The standard files (those that do not have the ClientName extension) will still exist and still be sought out when override resources do not exist.
- For any shown text in the interface, the order of places where the system will look for the text resource is thus as follows:
- ClientName override file for user’s browser language
- ClientName override file for default language
- ClientName override file for system default language (Danish) file
- Standard file for user’s browser language
- Standard file for default language
- System default language (Danish) file