This topic contains information specific to the localization of both Standard and Data Combo Box value lists:
- Localizing Values Lists for Standard Combo Boxes
- Localizing Static Values Lists for Views
- Localizing Value Lists for Data Combo Boxes
Localizing Values Lists for Standard Combo Boxes
To localize value lists for a standard static-list based combo box, specify a Culture Strings record for the value's name and description as shown below.
Below is an example of a standard static list-based combo box. On the left, the user is tied to the EN culture. On the right, the user is tied to the French culture.
Localizing Static Values Lists for Views
When a field with a static value list is added to a view, the actual value of the field is displayed, not the localized value. To display the localized value in a view, you must create a virtual field on the top-level entity to display localized values in a view. This is done by calculating the value of the virtual field with the SQL function fnGetLocalStringByCultureStringID to extract the culture strings associated with the values of the list.
The steps below provide an overview of how to create a virtual field to display localized values in a view:
- Open a new Fields record in the entity that includes the static combo box that you want to localize.
- Configure the necessary information in the top-area and on the field's General tab.
- Go to the Options tab and make sure the In Table option is cleared.
- The Virtual Field tab is enabled.
- Go to the Virtual Field tab and select Calculated as the Virtual Field Type.
-
Enter the appropriate syntax to display the static list values as localized. Below is an example of the syntax you can use where NameOfComboBoxField is replaced by the name of the field with the static value list and NameOfEntity is replaced by the name of the current entity.
SELECT dbo.fnGetLocalStringByCultureStringID(
(SELECT ISNULL(ValueCultureStringID,-1)
FROM dbo.vwEntityFieldValues ef
INNER JOIN dbo.vwEntities en ON ef.EntityID=en.ID
WHERE ef.Value=NameOfComboBoxField AND en.Name='NameOfEntity'), NameOfComboBoxField)
- Select OK to close the Fields record.
- Save and close the entity.
Below is an example of a view that includes the value of a standard static list-based combo box (the Standard Combo Box field) and a localized virtual field (the Static Value field).
Localizing Value Lists for Data Combo Boxes
A Data Combo Drop-Down field displays a list of records from another table in the database. By specifying a SQL statement, you define the drop-down list's contents from the corresponding table or entity. To localize the list's contents, you utilize the functions fnGetLocalStringByCultureStringID or fnGetLocalStringByCultureStringName to extract cultures for values of a data combo drop-down field.
The steps below provide an overview of how to localize the values in a data combo drop-down field:
- Open the Values record (or create a new one if one does not exist) that is associated with the data combo drop-down field that you want to localize.
- Determine which functions you want to use to extract the localized values from the culture string. The available functions are:
- fnGetLocalStringByCultureStringID (CultureStringID, BaseString): Use this function to specify the ID of the Culture Strings record. This function will work for values which are static and, regardless of value, return a single local string. This is the recommended approach whenever possible to ensure the correct local string is returned. The parameters that are associated with this function are:
- CultureStringID: The ID of the Culture Strings record.
- BaseString: The name of the base string associated with the Culture Strings record.
- fnGetLocalStringByCultureStringName (CultureStringName, BaseString): Use this function to specify the Name of the Culture Strings record. This function should be used when you do not know the ID of the Cultures String record and when more than one local string can be returned. The parameters that are associated with this function are:
- CultureStringName: The Name of the Culture Strings record.
- BaseString: The name of the base string associated with the Culture Strings record.
- fnGetLocalStringByCultureStringID (CultureStringID, BaseString): Use this function to specify the ID of the Culture Strings record. This function will work for values which are static and, regardless of value, return a single local string. This is the recommended approach whenever possible to ensure the correct local string is returned. The parameters that are associated with this function are:
- Specify a SQL statement to define the drop-down list's localized contents.
-
For example, if you want to show a data combo drop-down field that displays the records from the Member Type service as localized values, you could specify the following SQL statement in the Values record's Value field:
SELECT ID, [dbo].fnGetLocalStringByCultureStringName(Name,Name) Value FROM [APTIFY].[dbo].vwMemberTypes
-
In this example, the Member Type.Name field is being passed in for both the CultureStringName and the BaseString. So, this example assumes that the name of the Cultures Strings record and the base string are the same.
Note Concerning Culture String Naming Conventions
When using the SQL function fnGetLocalStringByCultureStringName to localize the value list for a SQL-sourced data combo box, you need to pass in both the Culture String Name and the Base String. For these situations, the simplest approach is to use the same value for the Culture String Name and the Base String for strings that you plan to localize using this function. For example, if you want your data combo drop-down field to display the records from the Member Type service, the Name and the Base String for the Culture Strings record associated with an individual member type could both be Individual Member to simplify the setup of the fnGetLocalStringByCultureStringName, so that you only need to identify and pass in one value to the function.
-
- Select OK to close the Values record.
- Select OK to close the Fields record.
- Save and close the entity.
Below is an example of a SQL-sourced data combo box. On the left, the user is tied to the EN culture. On the right, the user is tied to the French culture.
Comments
Please sign in to leave a comment.