Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Pentaho报告的翻译_Python_Pentaho_Pentaho Report Designer - Fatal编程技术网

Python Pentaho报告的翻译

Python Pentaho报告的翻译,python,pentaho,pentaho-report-designer,Python,Pentaho,Pentaho Report Designer,我正在尝试为Pentaho 4报告的自动转换制作一个脚本。我发现,*.prpt文件只是压缩的XML文件 Sooo,我创建了python脚本,它可以执行以下任一操作: 上传短语: 读取*.prpt文件中的文件 从中提取短语 将它们放入*.po文件中 将*.po文件上载到OneSky 下载翻译: 从OneSky下载*.po文件 解压缩原始*.prpt文件 用翻译替换文件中的原始短语 压缩新的*.prpt文件 虽然脚本似乎工作正常,所有步骤都执行正常,但“Pentaho报表设计器”无法打开新创建的*.

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

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

上传短语:

  • 读取
    *.prpt
    文件中的文件
  • 从中提取短语
  • 将它们放入
    *.po
    文件中
  • *.po
    文件上载到OneSky
  • 下载翻译:

  • 从OneSky下载
    *.po
    文件
  • 解压缩原始
    *.prpt
    文件
  • 用翻译替换文件中的原始短语
  • 压缩新的
    *.prpt
    文件
  • 虽然脚本似乎工作正常,所有步骤都执行正常,但“Pentaho报表设计器”无法打开新创建的
    *.prpt
    文件。有很多错误,但我设法发现,这可能不是我的修改情况

    通过测试,我提取了report
    *.prpt
    文件,并再次压缩它,没有任何修改。结果如何?与我修改的文件相同,报表设计器无法打开报表。这里有没有人有修改这些文件的经验

    技术细节:

    • 我的操作系统:Linux debian
    • 语言:python 2.7
    • ZIP库:zipfile
    • Pentaho bi服务器版本:3.8.0
    • Pentaho报表设计器版本:3.8.0
    同时添加ZIP文件比较:

    原始报告文件:

    我生成的报告文件:


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

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

    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%