[jira] [Commented] (OFBIZ-5316) Internationalisation of Birt reports

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-5316) Internationalisation of Birt reports

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-5316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13772006#comment-13772006 ]

Taher Alkhateeb commented on OFBIZ-5316:
----------------------------------------

Hi Jacques,

I know I am a bit late in submitting my work, but this is one of the things I'm introducing in the unified BIRT library discussed earlier. I show below some code snippets for your reference.

{code:javascript}
// uiLabels populated directly from within the script
uiLabelMap = FastMap.newInstance();
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("CommonUiLabels", reportContext.getLocale()));
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("AccountingUiLabels", reportContext.getLocale()));
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("PartyUiLabels", reportContext.getLocale()));
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("ProductUiLabels", reportContext.getLocale()));
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("OrderUiLabels", reportContext.getLocale()));
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("WorkEffortUiLabels", reportContext.getLocale()));
uiLabelMap.putAll(UtilProperties.getResourceBundleMap("ContentUiLabels", reportContext.getLocale()));

// A function to set report orientation (right to left or left to right) based on the locale provided
function setReportSettingsBasedOnLocale(localeString) {
    if (localeString.indexOf("ar") >= 0) { // TODO add other RTL locales
        designHandle.setProperty("bidiLayoutOrientation","rtl");
    } else {
        designHandle.setProperty("bidiLayoutOrientation","ltr");
    }
}

// entity labels extraction during "fetch" event
function getEntityLabelOnLocale(resourceName, entityName, entityValue) {
    if(entityValue == null) {
        return uiLabelMap.get("Undefined");
    } else {
        return UtilProperties.getMessage(
                resourceName,
                entityName+".description."+entityValue,
                reportContext.getLocale()
                );
    }
}

// date rendering based on locale
function getDateFormat(localeString) {
    if (localeString.indexOf("ar") >= 0) {
        return new SimpleDateFormat("yyyy/MM/dd", reportContext.getLocale());
    } else {
        return new SimpleDateFormat("dd/MM/yyyy", reportContext.getLocale());
    }
}
{code}

I am actually doing more like how to apply both entityLabels and uiLabels on the reports and how to do that consistently (the idea of the shared library) because in entityLabels, you have to prepare the values during the fetch event, whereas for the uiLabels you must actually bind it to the report layout with special DynamicText fields.

This is all done in my own reports, but sifting through all the existing reports for OFBiz is proving to be a bit lenghty especially when trying to be consistent across all reports. I guess this is why it is taking me some time to deliver stuff.

So anyway, I thought I'd share if it helps!
               

> Internationalisation of Birt reports
> ------------------------------------
>
>                 Key: OFBIZ-5316
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5316
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: specialpurpose/birt
>    Affects Versions: SVN trunk
>            Reporter: Jacques Le Roux
>            Priority: Minor
>             Fix For: SVN trunk
>
>
> Currently the Birt reports are not internationalised/localised. There is a way to do that it's explained here http://wiki.eclipse.org/BIRT/FAQ/Internationalization. I don't think we need to tweak to use uilabel files. We use the same way in the POS.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira