... | ... | @@ -31,8 +31,7 @@ Once the new strings are added to Transifex, translators can go and translate. A |
|
|
|
|
|
Clone [the Git repositories](https://github.com/civicrm/) from github:
|
|
|
|
|
|
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[
|
|
|
```
|
|
|
mkdir -p ~/repositories/
|
|
|
cd ~/repositories/
|
|
|
git clone https://github.com/civicrm/l10n.git
|
... | ... | @@ -40,10 +39,26 @@ git clone https://github.com/civicrm/civicrm-core.git civicrm |
|
|
git clone https://github.com/civicrm/civicrm-drupal.git civicrm/drupal
|
|
|
git clone https://github.com/civicrm/civicrm-joomla.git civicrm/joomla
|
|
|
git clone https://github.com/civicrm/civicrm-wordpress.git civicrm/wordpress
|
|
|
git clone https://github.com/civicrm/civicrm-packages.git civicrm/packages]]></script>
|
|
|
</div></div>
|
|
|
git clone https://github.com/civicrm/civicrm-packages.git civicrm/packages
|
|
|
```
|
|
|
|
|
|
NB: the ~/repositories/civicrm directory is only an example. You can use your preferred location.
|
|
|
|
|
|
The l10n repository contains:
|
|
|
|
|
|
<ul><li>"bin" : scripts for automating some of the tasks</li><li>"po/<lang>": translation files for each language</li><li>"po/pot/": .pot files are the source translation files (in English, as extracted from the CiviCRM code)</li></ul>
|
|
|
|
|
|
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/warning.png" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>The "po" files use a different file hierarchy than the default Transifex one.</p>
|
|
|
|
|
|
<p>NB: the ~/repositories/civicrm directory is only an example. You can use your preferred location.</p><p>The l10n repository contains:</p><ul><li>"bin" : scripts for automating some of the tasks</li><li>"po/<lang>": translation files for each language</li><li>"po/pot/": .pot files are the source translation files (in English, as extracted from the CiviCRM code)</li></ul><div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/warning.png" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>The "po" files use a different file hierarchy than the default Transifex one.</p><p>With Transifex, files are structured in the form of "civicrm.<component>/<lang>.po". In the l10n git repository, we use the structure "<lang>/<component>.po". It makes it easier to extract and compile only part of the translation. The magic for making this happen is in the file: l10n/.tx/config.</p></td></tr></table></div><h1 id="PushingnewstringstoTransifex-RefreshingPOTfiles">Refreshing POT files</h1><p>The "POT" files are the source translation files that will be sent to Transifex for translation. They contain the source US-English strings.</p><p>We need to regenerate the POT files when a new release branch is created (ex: v4.2) when the new release goes beta (to allow translators a bit of time to translate before the official release). If we do not refresh the files, translators will not be able to find the string in Transifex.</p><h2 id="PushingnewstringstoTransifex-GeneratingnewPOTfiles">Generating new POT files</h2><p>NOTE: the extraction creates a lot of temporary files in /tmp. If you do not have enough space in that directory, you can set the TMPDIR environment variable to use another directory (before running the build-unified-pots.sh script).</p><p>For example:</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<p>With Transifex, files are structured in the form of "civicrm.<component>/<lang>.po". In the l10n git repository, we use the structure "<lang>/<component>.po". It makes it easier to extract and compile only part of the translation. The magic for making this happen is in the file: l10n/.tx/config.</p></td></tr></table></div><h1 id="PushingnewstringstoTransifex-RefreshingPOTfiles">Refreshing POT files</h1><p>The "POT" files are the source translation files that will be sent to Transifex for translation. They contain the source US-English strings.</p><p>We need to regenerate the POT files when a new release branch is created (ex: v4.2) when the new release goes beta (to allow translators a bit of time to translate before the official release). If we do not refresh the files, translators will not be able to find the string in Transifex.</p>
|
|
|
|
|
|
<h2 id="PushingnewstringstoTransifex-GeneratingnewPOTfiles">Generating new POT files</h2>
|
|
|
|
|
|
<p>NOTE: the extraction creates a lot of temporary files in /tmp. If you do not have enough space in that directory, you can set the TMPDIR environment variable to use another directory (before running the build-unified-pots.sh script).</p>
|
|
|
|
|
|
<p>For example:</p>
|
|
|
|
|
|
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[mkdir ~/tmp
|
|
|
export TMPDIR=~/tmp]]></script>
|
|
|
</div></div><p>To run the extraction process, run:</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
... | ... | @@ -51,19 +66,39 @@ export TMPDIR=~/tmp]]></script> |
|
|
</div></div><p>You can also run the script on the "master" branch, but this is not recommended unless we are in beta:</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[./bin/build-unified-pots.sh ~/repositories/civicrm po/pot '4.2 4.3 4.4 master' 2>&1 | tee pots.log
|
|
|
]]></script>
|
|
|
</div></div><p>Note that the releases to be covered are all provided as one, quoted, space-separated string. This will (a) make fresh copies of the relevant releases in your temp directory, (b) bootstrap them with minimal config, (c) run GenCode to create all of the DAO files and (d) create the given release’s POT files, afterwards (e) combining the per-release POT files into release-agnostic POT files and (f) putting them in <code>po/pot</code>.</p><div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/warning.png" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>Gettext will emit a warning if it detects an incorrect use of the ts() function. For example, ts("Created $foo") is a common mistake. It should be written as ts("Created !1", array(1 => $foo)). For more information, see the <a href="/confluence/display/CRMDOC/Internationalisation+for+Developers">Internationalisation for Developers</a>. If you find a mistake, correct it in the CiviCRM code, commit, then re-run the script.</p></td></tr></table></div><h2 id="PushingnewstringstoTransifex-Reviewnewtranslationstrings">Review new translation strings</h2><p>It's worth taking the time to review the new strings which have been added to CiviCRM to fix any spelling/grammar/typos mistakes in the original English strings.</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
</div></div>
|
|
|
|
|
|
<p>Note that the releases to be covered are all provided as one, quoted, space-separated string. This will (a) make fresh copies of the relevant releases in your temp directory, (b) bootstrap them with minimal config, (c) run GenCode to create all of the DAO files and (d) create the given release’s POT files, afterwards (e) combining the per-release POT files into release-agnostic POT files and (f) putting them in <code>po/pot</code>.</p><div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/warning.png" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>Gettext will emit a warning if it detects an incorrect use of the ts() function. For example, ts("Created $foo") is a common mistake. It should be written as ts("Created !1", array(1 => $foo)). For more information, see the <a href="/confluence/display/CRMDOC/Internationalisation+for+Developers">Internationalisation for Developers</a>. If you find a mistake, correct it in the CiviCRM code, commit, then re-run the script.</p></td></tr></table></div><h2 id="PushingnewstringstoTransifex-Reviewnewtranslationstrings">Review new translation strings</h2><p>It's worth taking the time to review the new strings which have been added to CiviCRM to fix any spelling/grammar/typos mistakes in the original English strings.</p>
|
|
|
|
|
|
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[git status
|
|
|
git diff --patience po/pot/*.pot | ./bin/diff-check.php]]></script>
|
|
|
</div></div><p>In any files were added (and are still "untracked" by git), you can add them to the git repository:</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[git add po/pot/something.pot
|
|
|
git commit -m "new file"]]></script>
|
|
|
</div></div><h2 id="PushingnewstringstoTransifex-PublishingPOTfilestoTransifex">Publishing POT files to Transifex</h2><p>Once the new files are generated, add them to the repository (<code>git add -p</code> if you want to take a look at what changed, <code>git add .</code> otherwise; <code>git commit</code> to commit and <code>git push</code> to push to the remote repository).</p><p>Transifex is nice enough to track the repository’s POT files, so the refreshed POT files do not need to be uploaded to Transifex explicitly. If needed, you can run: </p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[tx push -s]]></script>
|
|
|
</div></div><p>See the <code>.tx/config</code> file for more information.</p><p>If a new component was added to CiviCRM (i.e. you have a new something.pot that was created), it needs to be added to Transifex. For example:</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[tx set --auto-local -r civicrm.pcp 'po/<lang>.po' --source-lang en --source-file po/pot/pcp.pot --execute
|
|
|
</div></div>
|
|
|
|
|
|
<p>In any files were added (and are still "untracked" by git), you can add them to the git repository:</p>
|
|
|
|
|
|
```
|
|
|
git add po/pot/something.pot
|
|
|
git commit -m "new file"
|
|
|
```
|
|
|
|
|
|
<h2 id="PushingnewstringstoTransifex-PublishingPOTfilestoTransifex">Publishing POT files to Transifex</h2>
|
|
|
|
|
|
<p>Once the new files are generated, add them to the repository (<code>git add -p</code> if you want to take a look at what changed, <code>git add .</code> otherwise; <code>git commit</code> to commit and <code>git push</code> to push to the remote repository).</p><p>Transifex is nice enough to track the repository’s POT files, so the refreshed POT files do not need to be uploaded to Transifex explicitly. If needed, you can run: </p>
|
|
|
|
|
|
```
|
|
|
tx push -s
|
|
|
```
|
|
|
|
|
|
<p>See the <code>.tx/config</code> file for more information.</p><p>If a new component was added to CiviCRM (i.e. you have a new something.pot that was created), it needs to be added to Transifex. For example:</p>
|
|
|
|
|
|
```
|
|
|
tx set --auto-local -r civicrm.pcp 'po/<lang>.po' --source-lang en --source-file po/pot/pcp.pot --execute
|
|
|
tx push -s -r civicrm.pcp
|
|
|
tx pull -a -r civicrm.pcp]]></script>
|
|
|
</div></div><p>For more information: <a href="http://help.transifex.net/features/client/index.html#auto-local" class="external-link" rel="nofollow">http://help.transifex.net/features/client/index.html#auto-local</a></p><p>You will also have to add an entry in the .tx/config file (you can copy/adapt an entry for another file).</p><h1 id="PushingnewstringstoTransifex-PullingnewtranslationsfromTransifex">Pulling new translations from Transifex</h1><p>Before a release (or whenever we want to recompile MO files) new translations need to be pulled from Transifex. This is done with the Transifex Client; the configuration is already in the repository (in the <code>.tx</code> directory), so a simple</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
tx pull -a -r civicrm.pcp
|
|
|
```
|
|
|
|
|
|
<p>For more information: <a href="http://help.transifex.net/features/client/index.html#auto-local" class="external-link" rel="nofollow">http://help.transifex.net/features/client/index.html#auto-local</a></p><p>You will also have to add an entry in the .tx/config file (you can copy/adapt an entry for another file).</p><h1 id="PushingnewstringstoTransifex-PullingnewtranslationsfromTransifex">Pulling new translations from Transifex</h1><p>Before a release (or whenever we want to recompile MO files) new translations need to be pulled from Transifex. This is done with the Transifex Client; the configuration is already in the repository (in the <code>.tx</code> directory), so a simple</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
|
|
<script type="syntaxhighlighter" class="theme: Confluence; brush: java; gutter: false"><![CDATA[tx pull -a
|
|
|
]]></script>
|
|
|
</div></div><p>should suffice. After pulling the translations they should be committed to the repository (with <code>git add po; git commit -m 'pull from Transifex'; git push</code>).</p><h1 id="PushingnewstringstoTransifex-Pushfilestothegithubrepository">Push files to the github repository</h1><p><strong>Since 2013-01-18, this is done daily from sushi.c.o (on the "l10n" user account/crontab).</strong></p><p>Once you have finished adding/reviewing the .pot files, pulled the .po translations for each language, you can do a last review and push your changes to github:</p><div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
|
... | ... | |