Skip to main content
Solved

Issue when localizing values from drop down box

  • January 27, 2025
  • 6 replies
  • 53 views

Forum|alt.badge.img+1

​Hi everyone,

I'm experiencing an issue with the french translation of a field I added using a DAC extension. I thought I had done everything right, but my implementation isn't working (the english term is displayed instead of the french one) and I can't figure out why.

Version : Acumatica 24R114.

 

1°) The Field declaration in its DAC :

 

#region CegEStatus
[PXDBString(50, IsUnicode = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Electronic Status", Enabled = false, Visibility = PXUIVisibility.SelectorVisible)]
[EIStatuses.List]
public virtual string CegEStatus { get; set; }
public abstract class cegEStatus : BqlString.Field<cegEStatus> { }
#endregion

 

2°) EIStatuses list attribute configuration

    public class EIStatuses
    {
        #region Constants
        /// <summary>
        /// Published when the invoice has been uploaded to eFacture
        /// </summary>
        public const string IUploaded = "100";

        /// <summary>
        /// Published when the invoice has been completed to eFacture
        /// </summary>
        public const string IConfirmed = "101";

        /// <summary>
        /// Published when the invoice has been completed to eFacture
        /// </summary>
        public const string ICompleted = "102";

        /// <summary>
        /// Published when the invoice has been checked for viruses, and none were found
        /// </summary>
        public const string ISafetyCheckSucceeded = "103";

        /// <summary>
        /// Published when the invoice has been checked for viruses, and some were found
        /// </summary>
        public const string ISafetyCheckFailed = "104";

        /// <summary>
        /// Published when the invoice has been successfully validated(PDF format, XML technical checks, XML functional checks)
        /// </summary>
        public const string IValidated = "105";

        /// <summary>
        /// Published when the invoice has failed the validation(PDF format, XML technical checks, XML functional checks)
        /// </summary>
        public const string IValidationFailed = "106";

        /// <summary>
        /// Published when the invoice has been scheduled to be sent to the outgoing platform
        /// </summary>
        public const string IPlannedForDeposit = "107";

        #endregion

        #region Labels       

        private static readonly string[] _statusKeys = new string[]
        {
            IUploaded,
            IConfirmed,
            ICompleted,
            ISafetyCheckSucceeded,
            ISafetyCheckFailed,
            IValidationFailed,
            IValidated,
            IPlannedForDeposit,
        };

        private static readonly string[] _statusValues = new string[]
        {
            Messages.Uploaded,
            Messages.Confirmed,
            Messages.Completed,
            Messages.SafetyCheckSucceeded,
            Messages.SafetyCheckFailed,
            Messages.ValidationFailed,
            Messages.Validated,
            Messages.PlannedForDeposit,
            Messages.Deposited,
        };

        public class ListAttribute : PXStringListAttribute
        {
            public ListAttribute() : base(_statusKeys, _statusValues) { }    
        }

        #endregion
    }

 

3°) Message settings

Class : Cegid.Erp.Common.EInvoice.Messages.

[ExcludeFromCodeCoverage]
[PXLocalizable(Prefix)]
public static class Messages
{
        public const string Prefix = "Einvoicing";

        #region Electronic statuses
        public const string Uploaded = "Uploaded";
        public const string Confirmed = "Confirmed";
        public const string SafetyCheckSucceeded = "SafetyCheckSucceeded";
        public const string SafetyCheckFailed = "SafetyCheckFailed";
        public const string ValidationFailed = "ValidationFailed";
        public const string Validated = "Validated";
        public const string PlannedForDeposit = "PlannedForDeposit";
        public const string Deposited = "Deposited";
        #endregion
}

4°) Dictionary settings

When I look for the term “Validationfailed” in the dictionary, it appears with the french translation ‘Validation en erreur’. It is marked as used for the right messages class.

 

With these settings, I expect the CegEStatus field to display the translated value “validation en erreur” but it displays instead the original value “ValidationFailed”.

 

 
 

 

 

Best answer by ygagnaire12

@aaronjkeeney , I confirm that the issue was due to the the fact that I missed to add the localizations dedicated to the drop down list.

What was done :

What was missing :

 

View original
Did this topic help you find an answer to your question?

6 replies

Forum|alt.badge.img
  • Freshman I
  • 16 replies
  • January 29, 2025

Hello,

I’m not sure 100% if this is what you are looking for, but you just need to change the display values, correct? The code below might be a starting point for you. Essentially, I did this as a way to translate Acumatica’s string values to something more human-readable. I would imagine that you can do something similar for your numeric database codes and the French translations. 

    #region UsrItemStatus
    [PXString]
    [PXUIField(DisplayName="Item Status", Enabled = false)]
    [PXUnboundDefault(typeof(Search<InventoryItem.itemStatus,
                     Where<InventoryItem.inventoryID,
                     Equal<Current<ARPriceWorksheetDetail.inventoryID>>>>))]
    [PXStringList(
    new[] { "AC", "IN", "DE", "NS", "NR", "NP" },      // Database values (example)
    new[] { "Active", "Inactive", "Straight to Dumpster", "No Sales", "No Request", "No Purchases" }  // Corresponding descriptions
    )]
    public virtual string UsrItemStatus { get; set; }
    public abstract class usrItemStatus : PX.Data.BQL.BqlString.Field<usrItemStatus> { }
    #endregion

 

If you need to display French in one place and English in another, then you probably need a different approach, but this approach should work if I understood correctly. I think you already did something similar in you Labels region, but I do think that what you want can be accomplished when you set up your DAC.

--Aaron


Forum|alt.badge.img+1
  • Author
  • Varsity II
  • 46 replies
  • January 29, 2025

Hello ​@aaronjkeeney ,

Thank you for your reply. I intended the solution you are suggesting : using two array of strings in the PXStringList instead of a PXStringListAttribute. I would say that this part is working correctly : my list items are bounded to the matching label. What is not working is the translation to french of this label...


Forum|alt.badge.img
  • Freshman I
  • 16 replies
  • February 4, 2025

Maybe I misunderstood -- is it not possible to just hard code the French translations as the values of the array?


Forum|alt.badge.img+1
  • Author
  • Varsity II
  • 46 replies
  • February 4, 2025

Indeed ​@aaronjkeeney, This could be a solution, but the policy we have to adhere to dictates that all developments must be written in English and then translated using Acumatica's localization process.That being said, I think I have found a good track : as long as my message is used in a drop box, I should have a dedicated neutral value in LocalizationValue formatted like this {display name of my list} -> {my message} and this is missing right now. I just have a neutral value with my message. I run a new string collection to check that...


Forum|alt.badge.img+1
  • Author
  • Varsity II
  • 46 replies
  • Answer
  • February 5, 2025

@aaronjkeeney , I confirm that the issue was due to the the fact that I missed to add the localizations dedicated to the drop down list.

What was done :

What was missing :

 


Forum|alt.badge.img
  • Freshman I
  • 16 replies
  • February 5, 2025

Glad it’s working! Thanks for posting your solution and satisfying my curiosity


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings