[zanata-users] How to configure the "rules" section of the zanata.xml

David Mason damason at redhat.com
Thu Mar 5 23:41:23 UTC 2015


Hi Patrick

----- Original Message -----
> From: "Patrick Huang" <pahuang at redhat.com>
> To: "Axel Rousseau" <axel.rousseau at esperanto-france.org>
> Cc: "zanata-users" <zanata-users at redhat.com>
> Sent: Friday, 6 March, 2015 9:02:12 AM
> Subject: Re: [zanata-users] How to configure the "rules" section of	the	zanata.xml
> 
> Hi Axel,
> 
> Please make sure you are using client version 3.4.1 as there is a bug fix
> specific to mapping rules.
> 
> The pattern is to match one or more source documents. For a matched source
> document, its translation file location will be determined or defined using
> the rule.
> 
> If your file structure is like following (where {projectRoot} is the root of
> your project and where zanata.xml lives):
> {projectRoot}/templates/messages/kdeedu/kalzium.pot
> {projectRoot}/templates/messages/kdeedu/artikulate.pot
> {projectRoot}/eo/messages/kdeedu/kalzium.po
> {projectRoot}/eo/messages/kdeedu/artikulate.po
> 
> You can use below configuration:
> <src-dir>templates</src-dir>
> <trans-dir>.</trans-dir>
> <rules>
> <rule pattern="**/*.pot">{locale}/{path}/{filename}.po</rule>
> </rules>
> 
> I will explain the details here. Once you define your <src-dir> as template,
> file "templates/messages/kdeedu/kalzium.pot" will be mapped to a relative
> path file name which is "messages/kdeedu/kalzium.pot". It then will be
> partitioned into several tokens to form the variables. "messages/kdeedu/"
> become the {path}. "kalzium" become the {filename}. Given our <trans-dir> is
> defined as "." which means the same directory as zanata.xml or
> {projectRoot}. And rule is defined as {locale}/{path}/{filename}.po, for
> locale "eo", translation file will be written to or read from
> "{projectRoot}/eo/messages/kdeedu/kalzium.po". You can also replace {locale}
> with {locale_with_underscore} if you want all your locales to use underscore
> instead of hyphen. e.g. de-DE will become de_DE.
> 
> I hope this will make more sense. If you need further assistance please let
> us know.

This seems like a really helpful explanation. I suggest we include it as an example in the documentation. I think it is too much to add to http://zanata.org/help/cli/cli-configuration/ but we can put the example on a separate page and link to it.

Cheers,

David Mason
Software Engineer
L10n Engineering

Red Hat, Asia-Pacific Pty Ltd
Level 1, 193 North Quay
Brisbane 4000


> Regards,
> Patrick Huang
> Senior Software Engineer
> Engineering - Internationalisation
> Red Hat
> 
> 
> 
> 
> From: "Axel Rousseau" <axel.rousseau at esperanto-france.org>
> To: "zanata-users" <zanata-users at redhat.com>
> Sent: Thursday, March 5, 2015 8:30:44 PM
> Subject: [zanata-users] How to configure the "rules" section of the
> zanata.xml
> 
> Hi !
> My name is Axel Rousseau, i'm member of the esperanto team to translate KDE.
> 
> I need some help to configure my zanata.xml to find my .po files
> I've a lot of files to translate and the name of the file is :
> my_path/my_file.po
> (and not my_path/my_file/locale.po)
> i don't understand how to configure the rules tag in the zanata.xml file
> I read the documentation here : http://zanata.org/help/cli/cli-configuration/
> and i don't understand the example :
> <rules>
> <rule pattern="**/pot/*.pot">{locale}/{path}/{filename}.po</rule>
> <rule pattern="**/po/*.pot">{path}/{locale_with_underscore}.po</rule>
> </rules>
> what's mean the pattern ?
> why are they 2 lines ? (**/pot/*.pot and **/po/*.pot) ?
> I success to upload (push) with the zanata-cli the source files (the .pot
> files), but i didn't succes to push the translation files (the .po)
> 
> here are my zanata.xml file :
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <config xmlns=" http://zanata.org/namespace/config/ ">
> <url> https://translate.zanata.org/zanata/ </url>
> <project>kde-eo</project>
> <project-version>kdeedu</project-version>
> <project-type>gettext</project-type>
> <src-dir>templates/messages/kdeedu</src-dir>
> <trans-dir>eo/messages/kdeedu</trans-dir>
> <locales>
> <locale>eo</locale>
> </locales>
> <rules>
> ??? what should i write here ???
> </rules>
> </config>
> 
> and my files are like :
> eo/messages/kdeedu/kalzium.po
> eo/messages/kdeedu/artikulate.po
> ...
> 
> I would like to test with only one folder of the KDE files at first...
> 
> Thank you for your help,
> 
> Axel Rousseau
> 
> _______________________________________________
> zanata-users mailing list
> zanata-users at redhat.com
> https://www.redhat.com/mailman/listinfo/zanata-users
> 
> 
> _______________________________________________
> zanata-users mailing list
> zanata-users at redhat.com
> https://www.redhat.com/mailman/listinfo/zanata-users




More information about the zanata-users mailing list