I may need some help from @Artur on this one, but here’s my best guess.
The first one is derived from configuration but the labels are hard-coded. Therefore, we aren’t able to localize them at the moment. We’ll eventually need to convert these labels to i18n keys. Not sure that it’s been ticketed yet.
See Config.groovy
inventorySummary {
enabled = true
title = "react.dashboard.inventorySummaryData.title.label"
info = "react.dashboard.inventorySummaryData.info.label"
graphType = "horizontalBar"
type = 'graph'
endpoint = "/api/dashboard/inventorySummary"
datalabel = true
colors {
labels {
success = ["In stock"]
warning = ["Above maximum", "Below reorder", "Below minimum"]
error = ["No longer in stock"]
}
}
}
As a workaround you could probably set up configuration in openboxes-config.groovy to hard-code these yourself. This isn’t a good solution if you are trying to support multiple languages, but if everyone is comfortable with Ukrainian Dutch then it might be a workable solution for the time being.
openboxes.dashboardConfig.dashboardWidgets.inventorySummary.colors.labels.success = ["наявний"]
openboxes.dashboardConfig.dashboardWidgets.inventorySummary.colors.labels.warning = [...]
openboxes.dashboardConfig.dashboardWidgets.inventorySummary.colors.labels.error = [...]
Actually, that might not work because the code that generates the bar graph is also using those hard-coded values so that would likely lead to an error or a blank graph.
The second one is also derived from configuration, but we set the labels to be localized. You can see the i18n keys below.
See Config.groovy
expirationSummary {
enabled = true
title = "react.dashboard.expirationSummaryData.title.label"
info = "react.dashboard.expirationSummaryData.info.label"
graphType = "line"
type = 'graph'
endpoint = "/api/dashboard/expirationSummary"
timeFilter = true
colors {
datasets {
state6 = ["Expiration(s)"]
}
labels {
state5 = [
[code : "react.dashboard.timeline.today.label", message : "today"],
[code : "react.dashboard.timeline.within30Days.label", message : "within 30 days"],
[code : "react.dashboard.timeline.within90Days.label", message : "within 90 days"],
[code : "react.dashboard.timeline.within180Days.label", message : "within 180 days"],
[code : "react.dashboard.timeline.within360Days.label", message : "within 360 days"]
]
}
}
}
The third one is a dropdown populated by an enum value set.
https://github.com/openboxes/openboxes/blob/develop/src/groovy/org/pih/warehouse/core/ReasonCode.groovy#L130
We usually populate the list with the localized string using a custom taglib.
def selectInventoryAdjustmentReasonCode = { attrs, body ->
attrs.from = ReasonCode.listInventoryAdjustmentReasonCodes()
attrs.optionValue = { format.metadata(obj: it) }
out << g.select(attrs)
}
<g:selectInventoryAdjustmentReasonCode name="reasonCode"
value="${reasonCode}" noSelection="['':'']"/>
but in this case, it seems we’re using the default select taglib and populating with the raw enum value.
<g:select name="reasonCode"
value="${params.reasonCode}"
from="${org.pih.warehouse.core.ReasonCode.listInventoryAdjustmentReasonCodes()}"
noSelection="['':'']"
data-placeholder="${g.message(code: 'default.selectAnOption.label', default: 'Select an Option')}"
class="chzn-select-deselect"/>
Which should be an easy fix (when we get around to it).
Justin