【问题标题】:Translation of Pentaho reportsPentaho 报告的翻译
【发布时间】:2017-05-04 23:42:52
【问题描述】:

我正在尝试为 Pentaho 4 报告的自动转换制作一个脚本。我发现,*.prpt 文件只是 ZIPed XML 文件。

Sooo,我创建了执行以下任一操作的 python 脚本:

上传短语:

  1. 读取*.prpt文件中的文件
  2. 从中提取短语
  3. 将它们放入*.po文件中
  4. 上传*.po文件到OneSky

下载翻译:

  1. 从 OneSky 下载 *.po 文件
  2. 解压原始*.prpt文件
  3. 用翻译替换文件中的原始短语
  4. 压缩新的*.prpt 文件

虽然脚本似乎运行良好并且所有步骤都执行没有任何错误,但“Pentaho 报表设计器”无法打开新创建的*.prpt 文件。但是我设法发现有很多错误,这可能不是我修改的情况。

经测试,我提取了报告*.prpt文件,并再次压缩,没有任何修改。结果?与我修改后的文件一样,报表设计器无法打开报表。有没有人有修改这些文件的经验?

技术细节:

  • 我的操作系统:Linux debian
  • 语言:python 2.7
  • ZIP 库:压缩文件
  • Pentaho 双服务器版本:3.8.0
  • Pentaho 报表设计器版本:3.8.0

还添加 ZIP 文件比较:

原始报告文件:

Archive:  kpi2.prpt
Zip file size: 33203 bytes, number of entries: 50
-rw----     1.0 fat       41 b- stor 17-Feb-01 09:15 mimetype
-rw----     2.0 fat     5262 bl defN 17-Feb-01 09:15 META-INF/manifest.xml
-rw----     2.0 fat      733 bl defN 17-Feb-01 09:15 meta.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 content.xml
-rw----     2.0 fat    26497 bl defN 17-Feb-01 09:15 datadefinition.xml
-rw----     2.0 fat      673 bl defN 17-Feb-01 09:15 dataschema.xml
-rw----     2.0 fat      266 bl defN 17-Feb-01 09:15 datasources/compound-ds.xml
-rw----     2.0 fat     6623 bl defN 17-Feb-01 09:15 datasources/inline-ds.xml
-rw----     2.0 fat    26649 bl defN 17-Feb-01 09:15 datasources/scriptable-ds.xml
-rw----     2.0 fat     1226 bl defN 17-Feb-01 09:15 datasources/sql-ds.xml
-rw----     2.0 fat    69826 bl defN 17-Feb-01 09:15 layout.xml
-rw----     2.0 fat      436 bl defN 17-Feb-01 09:15 settings.xml
-rw----     2.0 fat     4823 bl defN 17-Feb-01 09:15 styles.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 subreport/content.xml
-rw----     2.0 fat      666 bl defN 17-Feb-01 09:15 subreport/datadefinition.xml
-rw----     2.0 fat        0 bl defN 17-Feb-01 09:15 subreport/datasources/
-rw----     2.0 fat      133 bl defN 17-Feb-01 09:15 subreport/datasources/compound-ds.xml
-rw----     2.0 fat     6987 bl defN 17-Feb-01 09:15 subreport/layout.xml
-rw----     2.0 fat     1247 bl defN 17-Feb-01 09:15 subreport/styles.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 subreport1/content.xml
-rw----     2.0 fat      664 bl defN 17-Feb-01 09:15 subreport1/datadefinition.xml
-rw----     2.0 fat        0 bl defN 17-Feb-01 09:15 subreport1/datasources/
-rw----     2.0 fat      133 bl defN 17-Feb-01 09:15 subreport1/datasources/compound-ds.xml
-rw----     2.0 fat     6992 bl defN 17-Feb-01 09:15 subreport1/layout.xml
-rw----     2.0 fat     1247 bl defN 17-Feb-01 09:15 subreport1/styles.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 subreport2/content.xml
-rw----     2.0 fat      776 bl defN 17-Feb-01 09:15 subreport2/datadefinition.xml
-rw----     2.0 fat        0 bl defN 17-Feb-01 09:15 subreport2/datasources/
-rw----     2.0 fat      133 bl defN 17-Feb-01 09:15 subreport2/datasources/compound-ds.xml
-rw----     2.0 fat     8866 bl defN 17-Feb-01 09:15 subreport2/layout.xml
-rw----     2.0 fat     1247 bl defN 17-Feb-01 09:15 subreport2/styles.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 subreport3/content.xml
-rw----     2.0 fat      671 bl defN 17-Feb-01 09:15 subreport3/datadefinition.xml
-rw----     2.0 fat        0 bl defN 17-Feb-01 09:15 subreport3/datasources/
-rw----     2.0 fat      133 bl defN 17-Feb-01 09:15 subreport3/datasources/compound-ds.xml
-rw----     2.0 fat     6988 bl defN 17-Feb-01 09:15 subreport3/layout.xml
-rw----     2.0 fat     1247 bl defN 17-Feb-01 09:15 subreport3/styles.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 subreport4/content.xml
-rw----     2.0 fat      669 bl defN 17-Feb-01 09:15 subreport4/datadefinition.xml
-rw----     2.0 fat        0 bl defN 17-Feb-01 09:15 subreport4/datasources/
-rw----     2.0 fat      133 bl defN 17-Feb-01 09:15 subreport4/datasources/compound-ds.xml
-rw----     2.0 fat     6976 bl defN 17-Feb-01 09:15 subreport4/layout.xml
-rw----     2.0 fat     1247 bl defN 17-Feb-01 09:15 subreport4/styles.xml
-rw----     2.0 fat      274 bl defN 17-Feb-01 09:15 subreport5/content.xml
-rw----     2.0 fat      781 bl defN 17-Feb-01 09:15 subreport5/datadefinition.xml
-rw----     2.0 fat        0 bl defN 17-Feb-01 09:15 subreport5/datasources/
-rw----     2.0 fat      133 bl defN 17-Feb-01 09:15 subreport5/datasources/compound-ds.xml
-rw----     2.0 fat     9053 bl defN 17-Feb-01 09:15 subreport5/layout.xml
-rw----     2.0 fat     1247 bl defN 17-Feb-01 09:15 subreport5/styles.xml
-rw----     2.0 fat      123 bl defN 17-Feb-01 09:15 translations.properties
50 files, 203465 bytes uncompressed, 26285 bytes compressed:  87.1%

我生成的报告文件:

Archive:  de_kpi2.prpt
Zip file size: 31583 bytes, number of entries: 44
-rw-r--r--  2.0 unx      133 b- defN 17-Apr-14 23:09 subreport2/datasources/compound-ds.xml
-rw-r--r--  2.0 unx     8831 b- defN 17-Apr-14 23:09 subreport2/layout.xml
-rw-r--r--  2.0 unx      776 b- defN 17-Apr-14 23:09 subreport2/datadefinition.xml
-rw-r--r--  2.0 unx     1247 b- defN 17-Apr-14 23:09 subreport2/styles.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 subreport2/content.xml
-rw-r--r--  2.0 unx      133 b- defN 17-Apr-14 23:09 subreport3/datasources/compound-ds.xml
-rw-r--r--  2.0 unx     6988 b- defN 17-Apr-14 23:09 subreport3/layout.xml
-rw-r--r--  2.0 unx      671 b- defN 17-Apr-14 23:09 subreport3/datadefinition.xml
-rw-r--r--  2.0 unx     1247 b- defN 17-Apr-14 23:09 subreport3/styles.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 subreport3/content.xml
-rw-r--r--  2.0 unx     5262 b- defN 17-Apr-14 23:09 META-INF/manifest.xml
-rw-r--r--  2.0 unx      133 b- defN 17-Apr-14 23:09 subreport/datasources/compound-ds.xml
-rw-r--r--  2.0 unx     6987 b- defN 17-Apr-14 23:09 subreport/layout.xml
-rw-r--r--  2.0 unx      666 b- defN 17-Apr-14 23:09 subreport/datadefinition.xml
-rw-r--r--  2.0 unx     1247 b- defN 17-Apr-14 23:09 subreport/styles.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 subreport/content.xml
-rw-r--r--  2.0 unx      133 b- defN 17-Apr-14 23:09 subreport4/datasources/compound-ds.xml
-rw-r--r--  2.0 unx     6976 b- defN 17-Apr-14 23:09 subreport4/layout.xml
-rw-r--r--  2.0 unx      669 b- defN 17-Apr-14 23:09 subreport4/datadefinition.xml
-rw-r--r--  2.0 unx     1247 b- defN 17-Apr-14 23:09 subreport4/styles.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 subreport4/content.xml
-rw-r--r--  2.0 unx      133 b- defN 17-Apr-14 23:09 subreport1/datasources/compound-ds.xml
-rw-r--r--  2.0 unx     6992 b- defN 17-Apr-14 23:09 subreport1/layout.xml
-rw-r--r--  2.0 unx      664 b- defN 17-Apr-14 23:09 subreport1/datadefinition.xml
-rw-r--r--  2.0 unx     1247 b- defN 17-Apr-14 23:09 subreport1/styles.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 subreport1/content.xml
-rw-r--r--  2.0 unx      133 b- defN 17-Apr-14 23:09 subreport5/datasources/compound-ds.xml
-rw-r--r--  2.0 unx     9018 b- defN 17-Apr-14 23:09 subreport5/layout.xml
-rw-r--r--  2.0 unx      781 b- defN 17-Apr-14 23:09 subreport5/datadefinition.xml
-rw-r--r--  2.0 unx     1247 b- defN 17-Apr-14 23:09 subreport5/styles.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 subreport5/content.xml
-rw-r--r--  2.0 unx     6623 b- defN 17-Apr-14 23:09 datasources/inline-ds.xml
-rw-r--r--  2.0 unx    26649 b- defN 17-Apr-14 23:09 datasources/scriptable-ds.xml
-rw-r--r--  2.0 unx      266 b- defN 17-Apr-14 23:09 datasources/compound-ds.xml
-rw-r--r--  2.0 unx     1226 b- defN 17-Apr-14 23:09 datasources/sql-ds.xml
-rw-r--r--  2.0 unx      733 b- defN 17-Apr-14 23:09 meta.xml
-rw-r--r--  2.0 unx    69804 b- defN 17-Apr-14 23:09 layout.xml
-rw-r--r--  2.0 unx    26467 b- defN 17-Apr-14 23:09 datadefinition.xml
-rw-r--r--  2.0 unx     4781 b- defN 17-Apr-14 23:09 styles.xml
-rw-r--r--  2.0 unx      436 b- defN 17-Apr-14 23:09 settings.xml
-rw-r--r--  2.0 unx      274 b- defN 17-Apr-14 23:09 content.xml
-rw-r--r--  2.0 unx       41 b- defN 17-Apr-14 23:09 mimetype
-rw-r--r--  2.0 unx      673 b- defN 17-Apr-14 23:09 dataschema.xml
-rw-r--r--  2.0 unx      123 b- defN 17-Apr-14 23:09 translations.properties
44 files, 203301 bytes uncompressed, 26179 bytes compressed:  87.1%

我已经检查了这些差异的含义,但我不确定所有这些差异。但是,我不知道如何修复/更改这些差异以及它们是否是问题的原因。

【问题讨论】:

    标签: python pentaho pentaho-report-designer


    【解决方案1】:

    你应该阅读 pentaho 文档here。 Pentaho 使用 i18 的属性文件,它工作得很好。我认为,如果您在制作报告时考虑到本地化,您应该能够应用与现在相同的流程,只需稍作更改,而无需解压缩 .prpt。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 2021-06-01
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      相关资源
      最近更新 更多