My colleague @robert.paulsen and I are in the process of adding our own metadata fields, from the ruleset to the viewer. We have succeeded in getting the custom metadata field to show up in the viewer:
But there is something amiss with the translation. We have copied the messages_en.properties file to our /opt/digiverso/viewer/config folder and configured it thus:
However, it doesn’t work as demonstrated above. Does anybody know where we are stepping wrong here?
it’s great to read that you are already this far! Great progress and great success!!
You don’t need to copy the entire messages file, only add the desired KEY=VALUE entries to the local one. Filename, folder and the format look good for me.
Have you tried restarting the tomcat process? If the file was not there during startup it might be, that the Goobi viewer does not recognize it. If you monitor the viewer.log file and you change something in the local message file you should see an entry like this:
DEBUG 2021-03-02 07:08:25.707 [Thread-6] io.goobi.viewer.messages.ViewerResourceBundle$1.run(ViewerResourceBundle.java:124)
File 'messages_en.properties' (language: en) has been modified, triggering bundle reload...
The change you mentioned above makes it easier to get the global message bundle. You don’t need to extract it from the jar file anymore. Starting from January this year you can find them unpacked in the filesystem (again).
Editing the global message files is always a bad idea, because they are overwritten each time you install an update…
No. The mechanism with the local messages files was always the same.
The difference we have since January is, that if you see for example a string in the UI that is translated via the messages, let’s say “Reading lists”, and you would like to rename it to let’s say “Favorites”, and you are wondering now what message key to use, you had to extract the global message file from the following file:
This might also mean that the messages.properties file has bad syntax. For example, all non-ASCII characters in message values must be unicode escaped (e.g. “ä” becomes “\u00e4”).
Then maybe it has indeed to do with permissions. Please check that /opt/digiverso/viewer/config/messages*.properties have the same permissions as config_viewer.xml in that same folder (assuming your local config works correctly right now).
The current owner of both /opt/digiverso/viewer/config/messages_en.properties and /opt/digiverso/viewer/config/config_viewer.xml is tomcat:tomcat. Still no luck after a tomcat restart. Do you know if it is correct that the tomcat user + tomcat group should be the owner of these files?
As long as tomcat has permissions to read the file (and it’s the same tomcat user that is actually running the Tomcat instance in which your viewer is deployed), this should be correct. We usually leave the group on tomcat and set the user to whoever needs to edit the files at the moment.
What are the individual permission settingson the file?
The permissions for the /opt/digiverso/viewer folder: drwxr-xr-x 36 tomcat tomcat 4.0K Feb 25 07:29 viewer
The permissions for the /opt/digiverso/viewer/config folder: drwxr-xr-x 4 tomcat tomcat 4.0K Mar 3 11:58 config
Does this give you anything? I tried modifying the file @ /var/lib/tomcat9/webapps/viewer/WEB-INF/classes/messages_en.properties which worked fine. Can we rely on modifying this file if all else fails?
Just to make sure, you didn’t happen to change the path pointing to the local config folder in the default config file (/var/lib/tomcat/webapps/viewer/WEB-INF/classes/config_viewer.xml)?
It should say: <config> <configFolder>/opt/digiverso/viewer/config/</configFolder> </config>
If we can rely on the default config file at /var/lib/tomcat9/webapps/viewer/WEB-INF/classes/config_viewer.xml we should be covered for the time being while we continue to debug why our local messages_en.properties cant be loaded.
@ahl.nilsen the global config_viewer.xml (/var/lib/tomcat9/webapps/viewer/WEB-INF/classes/config_viewer.xml) is overwritten each time you update the software. All modifications should be added to the local one (/opt/digiverso/viewer/config/config_viewer.xml)