To Prepare DACs for Localization

When the system localizes the fields of the data access classes (DACs) and DAC names, it collects the string constants that are specified in the following code elements:

  • The DisplayName property of the PXUIField attribute of the fields of DACs
  • The AllowedLabels property of the PXStringList attribute or PXIntList attribute of the fields of DACs

To prepare each DAC for localization, you need to perform the steps that are described in this topic.

To Prepare Each DAC for Localization

  1. Make sure the DisplayName parameter of the PXUIField attribute is specified for each visible field in the DAC, as shown in the following example.
    Note: If you change the DisplayName value of the PXUIField attribute on the fly (by creating your own PXFieldState), you should localize the string independently.
    public new abstract class docType : PX.Data.IBqlField{}
    [PXDBString(3, IsKey = true, IsFixed = true)]
    [PXDefault()]
    [PXUIField(DisplayName = "Document Type")]
    public override string DocType { get; set; }
  2. Specify the values that should be displayed in drop-down lists by using the PXStringList attribute, as shown in the following example.
    public abstract class lineSource : PX.Data.IBqlField{}
    [PXString(1, IsFixed = true)]        
    [PXStringList(
        new string[] { "D", "R" },
        new string[] { "Draft", "Request" })]
    [PXUIField(DisplayName = "Line Source")]
    public virtual string LineSource { get; set; }
  3. For localization of the list of strings that are used as options of a radio button, specify the value of the DisplayName property of PXUIField for strings in PXStringListAttribute, as shown in the following example.
    Note: The -> character separates the name of the list from the command.
    public abstract class displayMode : PX.Data.BQL.BqlString.Field<displayMode> 
    { 
    	public const string AllEntries = "A";
    	public const string Matched = "M";
    	public const string NotMatched = "N";
    
    	[PXLocalizable]
    	public class Messages
    	{      public const string AllEntries = "Display Mode -> Display All Entries";
    		public const string Matched = "Display Mode -> Matched";
    		public const string NotMatched = "Display Mode -> Not Matched";}
    
    	public class ListAttribute : PXStringListAttribute
    	{public ListAttribute() : base(
    	    new[] { AllEntries, Matched, NotMatched },
    	    new[] { Messages.AllEntries, Messages.Matched, Messages.NotMatched }){ }}
    }
    
    [PXString]
    [displayMode.List]
    [PXUIField(DisplayName = "Display Mode")]  
    [PXDefault(displayMode.AllEntries)]  
    public virtual string DisplayMode { get; set; }