2

私はBIRTレポートエンジンを使用しており、現在のタスクはレポートの国際化を実装することです。Webviewerを使用してPDFレポートを生成およびダウンロードしています。レポートの生成に使用するロケールを指定できるパラメーター(__locale)があります。これまでのところ、すべてが正常に機能しています。

ただし、実装できなかった追加の要件があります。httpパラメータで設定されたロケールに加えて、ある種のフォールバックロケールを指定する可能性もあるはずです。

Take the following example: There are two property-files common_en_US.properties and common_en_GB.properties. The first locale to be used should be en_GB (__locale=en_GB). Everything works fine if the common_en_GB.properties file exist. But I would also like to tell BIRT to use common_en_US.properties if the en_GB-file cannot be found, which does not work as expected.

I tried to solve this by manually setting the Java default locale before executing BIRT because I thought that BIRT would use the Java mechanism to resolve localized strings. Unfortunately this attempt does not work.

Is there a different way to do what I would like to do? Is it possible to do something like that at all?

Thanks a lot! Johannes

4

1 に答える 1

3

そのため、ロケールを指定すると、BIRT はそのロケールのプロパティ ファイルのみを検索します。デフォルトの JVM ロケールは使用されません。プロパティ ファイルが見つからない場合は、デザイナーでコントロールに適用される既定のテキストが使用されます。

詳細な背景はこちら: BIRT と国際化

したがって、BIRT ではサポートされていないロケールの階層を作成する必要があります。レポートを手動で (サーブレットまたは他の POJO を介して) レンダリングする場合は、コードでロケールを強制できますIRunAndRenderTask( というメソッドがありますsetLocale) 。

于 2010-04-22T16:19:40.940 に答える