Localization resources

Resources are used to organize and translate short texts in the user interface. Here's an example of a resource:
 
App.LoginStatus.Welcome
 
Each resource is identified by a unique Name , consisting of three parts separated by periods: Context, Group and Key. This hierarchical structure facilitates the organization and retrieval of resources:
 
Context.Group.Name
 
  • Context: Represents a specific area of the application, such as Account, MobileApp, App, or PrivateArea. The context serves to segment resources, reducing bandwidth consumption and improving delivery and rendering times. Ideally, when loading a page, as few contexts as possible should be invoked

     

  • Group: Further breaks down resources by sections, pages, or application components. Typical examples of groups include Catalogue, Login, Registration, Header, Footer, and Alert. The group clarifies the position of the resource within the project structure

     

  • Key: indicates the specific translation in that context and in that group. Usually, the key is the English version of the text without articles, spaces, or special characters, such as ClickHere, Hello, or Surname

 

It is important to note that each part of the Name can contain up to 50 characters, must begin with a capital letter, and must not include spaces or special characters.

 

Resource Usage
Resources are primarily used as placeholders in code to handle the translation of short UI texts.

They are not suitable for long texts, formatted texts, and sensitive data.

 

Please note: given the way in which they are structured and delivered, resources must be considered "untrusted" and freely navigable. To handle sensitive data, alternative strategies must be adopted.

 

You can customize the text of an asset by inserting interpolation points into the value using curly brackets.

For example, a resource with Name App.LoginStatus.Welcome and value "Welcome {0} {1}" will require the developer to provide the necessary parameters when rendering the page.

 

Best practices for asset naming
While there is some freedom in naming assets, following a few guidelines can make your team's work easier:

 

  • Avoid spaces and special characters: Resource names without spaces or special characters ensure greater consistency
  • Use of underscore: Underscore can be used to emphasize subdivisions in the group or key
  • English texts: all texts should be in English for uniformity
  • Context: it should represent an autonomous area of the project to improve performance by segmenting the recovery of resources
  • Group: Must clearly state the component, page, or section of the resource
  • Key: should be the English value of the text, starting with the verb if it represents an action (e.g. OpenLink, StartAction, EditItem)

     

The repetition of the same keys in different contexts or groups is recommended to allow the deactivation of entire modules without interfering with others. This approach also allows developers to quickly enter the name of a resource during development, reserving detailed management for a later phase, possibly with the support of the Resource Manager.

 

The Resource Manager
Within the team, a Resource Manager should be designated, i.e. a figure in charge of periodically analyzing resources through the Resource Analyzer tool and the Resources section of DataWeb. The Resource Manager can introduce Common groups to collect general or repetitive resources. These strategies should be evaluated at a later stage of development and orchestrated by a person with a broad vision of the project.