Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After the code review, the configuration (bootstrap) files have to be reviewed, and values of properties label and description (and alternatively others) will be replaced with a proper message key. Such message key (and value) will be added to the messages_en.properties file of the admincentral UI module (or the other module's messages file), and the path of the property + the key will be added to the list of changed properties (one list for each module), which will be then used in the VersionHandlerto replace the values on the upgrade (using new UpdateI18nPropertiesTask).

Code Block
languagejava
titleUpdateI18nPropertiesTask proposal
public class UpdateI18nPropertiesTask extends AbstractRepositoryTask {


    // ...
 
    public UpdateI18nPropertiesTask(String name, String description, String propertyListFilename) {
        super(name, description);
        this.propertyListFilename = propertyListFilename;
    }

    @Override
    protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
        Map<String, String> pathsAndValues = loadFromFile();
        for (String path : pathsAndValues.keySet()) {
            Node node = getNode(path); // path is the path to property, this gets the last node on the path
            String propertyName = getPropertyPath(path); // the part of the path after the last "/"
            Property prop = PropertyUtil.getPropertyOrNull(node, propertyName);
            if (prop!=null) {
                // if exists, replace
                PropertyUtil.setProperty(node, propertyName, pathsAndValues.get(path));
            }
        }
    }
 
    // ...
 
}

 

 

i18nBasename

In the Magnolia up to 4.5, it is possible to define i18nBasename property in a dialog configuration to define a different message bundle. In Magnolia 5, this still works, just the property has to be placed under the form sub-node of the dialog.

...