Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6241

The messages are not replaced by new one when they are duplicated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • None
    • None
    • core, i18n
    • Sprint 2 (Vietnam)
    • 0

    Description

      In info.magnolia.i18nsystem.DefaultMessageBundlesLoader,
      This line of code let user know that the old message will be replace with new one:

      log.warn("Found duplicate key [{}] at file [{}]. The new key will overwrite the existing one. Please set the log level of this class to DEBUG to find out more.", key, propertiesFile);
      

      But actually, the logic in the code below, it keeps the old messages:

       final Properties properties = new Properties();
       properties.load(inStream);
       Properties existingProperties = messages.get(locale);
      
       if (existingProperties != null) {
          checkForDuplicates(existingProperties, properties, propertiesFile);
          // this locale already exists in our bundle, add the new ones
          log.debug("Adding properties to already existing ones under {} locale", locale);
          properties.putAll(existingProperties);
       }
      
       messages.put(locale, properties);
      

      In the case user want to modify the core messages:

      • they have to create a module that extends core
      • defines messages with same keys,
        but it will not work.

      So, the logic should be changed:
      the new message should replace the old message.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                trang.truong Trang Truong
                sang.ngo Sang Ngo Huu
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD

                    Time Tracking

                      Estimated:
                      Original Estimate - 2.5h Original Estimate - 2.5h
                      2.5h
                      Remaining:
                      Remaining Estimate - 0d
                      0d
                      Logged:
                      Time Spent - 2d 3h
                      2d 3h