Zanata備忘録

  • githubmaven プロジェクト作る
  • Zanata にユーザ登録する
  • Zanata にプロジェクト作る
  • Zanata のユーザプロファイルに zanata.ini の中身があるので、コピーして、ローカルに ~/.config/zanata.ini 作成
  • Zanata プロジェクトにバージョンを作成
  • Zanata プロジェクトのバージョンから、「設定ファイル」で zanata.xml がダウンロードできる
  • git のプロジェクトのどっかに zanata.xml 置く
  • pom.xml はこんな感じ
  <build>
    <finalName>sandbox</finalName>
    <plugins>
      <!-- Zanata - translations -->
      <plugin>
	<groupId>org.zanata</groupId>
	<artifactId>zanata-maven-plugin</artifactId>
	<version>2.3.0</version>
	<configuration>
          <projectConfig>${session.executionRootDirectory}/src/main/config/zanata.xml</projectConfig>
          <srcDir>src/main/resources/</srcDir>
          <transDir>src/main/resources/</transDir>
          <includes>**/*Constants.properties</includes>
	</configuration>
      </plugin>
    </plugins>
  </build>
  • mvn zanata:help
  • mvn zanata:help -Ddetail=true
  • mvn zanata:push-module
  • mvn -B zanata:pull-module

push/pull ではなく push-module/pull-module のほうがファイルパスをインテリジェントに処理してくれるようだ。mavenプロジェクトが階層構造の場合は必須?

http://zanata.org/help/maven-plugin/maven-plugin-install/
http://zanata.org/help/maven-plugin/maven-plugin-config/
http://zanata.org/help/maven-plugin/maven-plugin-commands/
https://github.com/zanata/zanata-server/wiki/Integration-Guide
https://github.com/zanata/zanata-client/blob/master/zanata-maven-plugin/sample-scripts/README-scripts.md

https://community.jboss.org/wiki/HowI18NIsBuiltInDroolsjbpmWorkbenchProjects

<tkobayas> Hello, this project wrongly maps zh_CN to zh-Hant https://translate.jboss.org/iteration/view/uberfire/0.3.0?cid=18488
<tkobayas> zanata.xml
<tkobayas>   <locales>
<tkobayas>     ...
<tkobayas>     <locale map-from="zh_CN">zh-Hant</locale>
<tkobayas>   </locales>
<tkobayas> So I'm going to ask developers to edit the zanata.xml to map to zh-Hans and do "mvn zanata:push-module"
<tkobayas> Is it safe? will not lose current translatoins? (there is no translation in zh-Hant yet. But other langs are done. e.g. ja_JP)
<tkobayas> Do developers have to do "mvn zanata:pull-module" first?
<damason> tkobayas, it should not lose any translations that are already on the server
<tkobayas> damason, thx, so no need to "mvn zanata:pull-module" first?
<damason> tkobayas, if there are no translations in zh-Hant yet then there would be no need to do a pull first
<damason> the only reason to do a pull would be if there are translations in the language that you are removing that you want to put in the language that you are adding
<tkobayas> damason, ah, but i thought  "mvn zanata:push-module" will overwrite other lang like ja_JP with old local resources. <- is it wrong?
<damason> I just looked at the project and can say that there is definitely no need to run "mvn zanata:pull-module" first in this case.
<damason> tkobayas, the default behaviour for push should only push source files
<tkobayas> damason, thx! got it! :)
<damason> tkobayas, sflanigan should be able to confirm that, I think he implemented push-module
<sflanigan> push/pull-module just remaps the filenames to handle maven modules a little better.  Other than that, it's just the same as push/pull.
<sflanigan> tkobayas, if there are no translations to be pushed yet, there's no need to run push or push-module
<sflanigan> (because the mapping only affects translations, and there aren't any to push yet.)
<sflanigan> once the zanata.xml mapping is fixed, the next time the dev runs pull(-module), the zh-Hans strings will be saved as zh-CN in the local filesystem.
<tkobayas> sflanigan, hmm, now translators are asking us to fix that the project displays "zh-Hant" in Zanata. Shouldn't we fix the "zh-Hant" to "zh-Hans" first?
<sflanigan> I'm not sure what you're asking.
<tkobayas> they want to add "zh-Hans" translation. But the project https://translate.jboss.org/iteration/view/uberfire/0.3.0?cid=18488 shows "zh-Hant".
<tkobayas> the problem is zanata.xml in the project.
<tkobayas>   <locales>
<tkobayas>     ...
<tkobayas>     <locale map-from="zh_CN">zh-Hant</locale>
<tkobayas>   </locales>
<sflanigan> okay, sure, just add the other language on the server  (and remove the old if you wish)
<sflanigan> then you will need to update the zanata.xml mapping as you said
<sflanigan> If you're not planning to support zh-TW/zh-Hant, then yes, you should disable that language on the server.
<tkobayas> sflanigan, oh, so project maintainers can add a language in Zanata web UI? (I'm not a project maintainer)
<sflanigan> as long as the server admin has enabled that language, yes
<tkobayas> sflanigan, thx a lot! my question is completely solved. 
<sflanigan> unfortunately, the project maintainer does need to update both the project's languages, and the zanata.xml file.
<tkobayas> sflanigan, damason thx guys :)
<sflanigan> no problem
Pushing *modified* source files won't affect existing translations, so
it should be fine.  Any translations which still apply will still be there.

Just FYI, *renaming* source files can give the appearance of losing
translations (because rename is implemented as deleting the old document
and creating a new document), but the old data stays in the database,
and the project maintainer can run CopyTrans to reuse the translations
(just tell CopyTrans to ignore document name).

Also, pushing *translation* files (with the client's "pushTrans" option,
or "pushType=both") can affect existing translations in Zanata, but only
if you use mergeType=import.  mergeType=auto is the default mode, and it
is pretty safe.  (If all translations are done in Zanata, there's
generally no need for the project maintainer to push translations into
Zanata.)

If you have more questions about Zanata, I recommend this list:
https://www.redhat.com/mailman/listinfo/zanata-users