Birt internationalization doesn't work

淺唱寂寞╮ 提交于 2020-01-06 20:01:13

问题


here is what I did : I downloaded Birt Runtime 4.2. I deployed the WebViewerExample and added my report design to it.

I created a few resource/properties files and referenced them like shown below :

Then I selected the appropriate key for a graph title in the report.

Result : in eclipse, the key is changed by the value contained in the resource file at the top of the list. In the browser, the default value of my graph title is still displayed...

I did everything explained here http://wiki.eclipse.org/BIRT/FAQ/Internationalization. I also tried to set the path of my properties files in the web.xml :

 <!-- Resource location directory. Defaults to ${birt home} -->
    <context-param>
            <param-name>BIRT_RESOURCE_PATH</param-name>
            <param-value>resource/</param-value>
    </context-param>

I tried different paths such as WebContent/resource, or the absolute path, none worked.

My locale is set multiple times : in the web.xml I put

<!-- Default locale setting.
-->
<context-param>
    <param-name>BIRT_VIEWER_LOCALE</param-name>
    <param-value>en-US</param-value>
</context-param>

I also placed the parameter __locale=en_US in the url just in case it wouldn't work. But the title is not displayed in english, and it doesn't use any of my properties file either.

I am losing faith now... Any idea ?


回答1:


Finally corrected the bug. The problem's source is the path of the resources.

Here is what to do so that it works. If you're using Eclipse and get the same error as me, then go to Window > Preferences > Report Design > resource and change the resource folder to the one with your resources in it (instead of << Current Projet Folder >>).

Now, reference your base resource file (like resources.properties, and not all languages, just the default one, Birt will find the other resources_lang.properties etc on his own).

You should now have something like this : (resource file called birtText.properties here)

If the version of your report designer is the different from the version of your Birt runtime, take care. The report designer will change some versions in the report.design xml source. You may face a runtime problem. To avoid that, check the differences between the old xml and the new. And put back everything that is not linked to the new properties files referenced (there should be only one group of new lines concerned by the linking).

Edit : just putting the line <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22" id="1"> back as it was should be enough.

This error came from the fact that the birt report designer resource folder was different from the default resource path specified in the web.xml - used by the report engine (the report folder is default).

Hope this helps. It solved my problem.



来源:https://stackoverflow.com/questions/11613450/birt-internationalization-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!