Language Dutch -> Crowdin

Yeah I see a similar error …

DevTools failed to load source map: Could not load content for https://d2gma3rgtloi6d.cloudfront.net/editor/a69d9f20/crowdin-editor/main.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
21:40:38.383 DevTools failed to load source map: Could not load content for https://d2gma3rgtloi6d.cloudfront.net/editor/a69d9f20/crowdin-editor/css-new/editor.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

… but it doesn’t cause any issues with the Crowdin feature at all.

If you want me to investigate further we could jump on a screen share sometime next week or you could send a video of what you’re seeing.

Have a great weekend.

Justin

I’ll make you a nice screenrecording :slight_smile:

Ya hello! → OpenBoxes - YouTube

Hi @David_Douma, since Justin is out of the office for the next 2 days, I’ll try to help with this one.

Could you do two things:

  1. Readd Acholi to the supported locales (ach, I see that you have only English and Dutch)
    /\ If that won’t help, then:
  2. Could you show here responses that you get for the requests to pull translations on the pages that do not work for you and the response for the request to “enter the translation mode” while you are on these pages)

Oh wow yes, first option worked (for now). Is this a known bug?

@David_Douma I’d say it is not a bug, but a requirement for Crowdin to work properly.

Ah, the language Acoli?

Yup. It needs to be in the supported locales currently.

I’m not able to figure out where to translate (where the file or text is located) for the next things:

image

image

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

Re. 1. I think there are two things: first adding the label keys as @jmiranda suggested and second required change would be using these labels here (using message tag): https://github.com/openboxes/openboxes/blob/develop/grails-app/services/org/pih/warehouse/dashboard/IndicatorDataService.groovy#L332

Re. 2 As @jmiranda suggested adding/modifying react.dashboard.timeline.(...) labels in your messages file should work here.

Re. 3 As @jmiranda suggested, this one needs the mentioned change in the select and reason code translations can be found under enum.ReasonCode.(...).label (eg. enum.ReasonCode.CORRECTION=Correction

@David_Douma let me know if you need more help with this.