2017-04-14 81 views
0

我想爲Pentaho 4報告的自動轉換做一個腳本。我發現,*.prpt文件只是ZIP壓縮的XML文件。Pentaho報告的翻譯

的sooo,我創建的Python腳本,做任何以下的:

上傳短語:

  1. 讀取文件內*.prpt文件從他們
  2. 提取短語
  3. 認沽他們分成*.po檔案
  4. 上傳*.po文件OneSky

下載翻譯:

  1. 下載*.po文件從OneSky
  2. 解壓原*.prpt文件
  3. 通過翻譯
  4. 壓縮新的文件替換原短語*.prpt檔案

雖然腳本似乎完美工作,並且所有步驟都沒有任何錯誤地執行,但新創建的*.prpt文件無法通過「Pentaho報表設計器」打開。但是我發現了很多錯誤,可能不是我的修改。

通過測試,我提取了報告*.prpt文件,並再次壓縮,沒有任何修改。結果?與我的修改文件相同,Report Designer無法打開報告。這裏有誰有這些文件的修改經驗嗎?

技術細節:

  • MY操作系統:Linux的Debian
  • 語言:Python 2.7版
  • ZIP庫:zip文件
  • 的Pentaho BI服務器版本:3.8.0
  • 的Pentaho報表設計器版本:3.8。0

加入也ZIP文件comparsion:

原始報告文件:

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% 

我有檢查瞭解這些差異意味着什麼,但我不確定所有這些差異。但是我不知道如何解決/改變這些差異,以及它們是否是問題的原因。

回答

0

您應該閱讀pentaho文檔here。 Pentaho使用i18的屬性文件,它工作得很好。我認爲,如果您使用本地化報告製作報告,您應該能夠應用現在使用的相同流程進行輕微更改,而無需拆封.prpt。