[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: Review Request 7106: AppStream support for l10n-script (example)
From:       "Matthias Klumpp" <matthias () tenstral ! net>
Date:       2014-04-23 23:57:43
Message-ID: 20140423235743.3535.55617 () probe ! kde ! org
[Download RAW message or body]

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://svn.reviewboard.kde.org/r/7106/#review11095
-----------------------------------------------------------



trunk/l10n-kde4/scripts/extract_metainfo.sh
<https://svn.reviewboard.kde.org/r/7106/#comment14050>

    This will not work, since itstool will override the old metainfo file, so we'll \
end up with the file being just translated into one language.  We'd rather need to \
supply itstool a list of all *.mo files found/generated once.  


- Matthias Klumpp


On April 23, 2014, 11:54 p.m., Matthias Klumpp wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://svn.reviewboard.kde.org/r/7106/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 11:54 p.m.)
> 
> 
> Review request for Localization and Translation (l10n) and Albert Astals Cid.
> 
> 
> Repository: kde
> 
> 
> Description
> -------
> 
> Hi!
> It's very difficult to extend the l10n-script if you don't know it's internal \
> workings, and if all comments are stripped out, so in order to get AppStream \
> support into the l10n-script, I created two small bash scripts to translate \
> AppStream upstream metadata: 
> extract_metainfo.sh: This script generates .pot files from metadata
> XML files found in a project. Just cd to the directory you want the
> resulting pot files to be stored in, then call the script and point it
> at the project's source tree you want to be searched for the XML
> files.
> 
> merge_metainfo.sh: The script merges translation back into the XML
> files. Simply cd to a directory which stores .mo files with the
> translated data and call the script with the project's source dir as
> first parameter.
> 
> These scripts illustrate how translation of the XML can be done in
> KDE. I would kindly ask the l10n-script developers to take a look at
> it any maybe integrate it at the proper places, because they know the
> code way better than I do.
> The scripts can also be found at:
> http://people.freedesktop.org/~mak/appstream/kde-asmetadata-l10n.tar.gz
> (I also included a demo XML file there)
> 
> If you have questions, please let me know!
> Cheers,
> Matthias
> 
> 
> Diffs
> -----
> 
> trunk/l10n-kde4/scripts/merge_metainfo.sh PRE-CREATION 
> trunk/l10n-kde4/scripts/extract_metainfo.sh PRE-CREATION 
> trunk/l10n-kde4/scripts/as-metainfo.its PRE-CREATION 
> trunk/l10n-kde4/scripts/update_translations 1384853 
> 
> Diff: https://svn.reviewboard.kde.org/r/7106/diff/
> 
> 
> Testing
> -------
> 
> * Finds AppStream metadata in project source directories
> * .pot extraction works
> * Merging translation to untranslated files works
> * Merging new translation into already translated metadata files works (without \
>                 duplicating entries)
> * Resulting files are valid AppStream metadata files (compliance-check passed)
> 
> 
> Thanks,
> 
> Matthias Klumpp
> 
> 


[Attachment #3 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://svn.reviewboard.kde.org/r/7106/">https://svn.reviewboard.kde.org/r/7106/</a>
  </td>
    </tr>
   </table>
   <br />











<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://svn.reviewboard.kde.org/r/7106/diff/2/?file=48585#file48585line25" \
style="color: black; font-weight: bold; text-decoration: \
underline;">trunk/l10n-kde4/scripts/extract_metainfo.sh</a>  <span \
style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">25</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    itstool \
-j <span class="nv">$tmpxmlfile</span> -o <span class="nv">$metainfo_file</span> \
<span class="nv">$tmpmofile</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This will \
not work, since itstool will override the old metainfo file, so we&#39;ll end up with \
the file being just translated into one language. We&#39;d rather need to supply \
itstool a list of all *.mo files found/generated once. </pre>
</div>
<br />



<p>- Matthias Klumpp</p>


<br />
<p>On April 23rd, 2014, 11:54 p.m. UTC, Matthias Klumpp wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://svn.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Localization and Translation (l10n) and Albert Astals \
Cid.</div> <div>By Matthias Klumpp.</div>


<p style="color: grey;"><i>Updated April 23, 2014, 11:54 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kde
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Hi! It&#39;s very difficult to extend the l10n-script if you don&#39;t \
know it&#39;s internal workings, and if all comments are stripped out, so in order to \
get AppStream support into the l10n-script, I created two small bash scripts to \
translate AppStream upstream metadata:

extract_metainfo.sh: This script generates .pot files from metadata
XML files found in a project. Just cd to the directory you want the
resulting pot files to be stored in, then call the script and point it
at the project&#39;s source tree you want to be searched for the XML
files.

merge_metainfo.sh: The script merges translation back into the XML
files. Simply cd to a directory which stores .mo files with the
translated data and call the script with the project&#39;s source dir as
first parameter.

These scripts illustrate how translation of the XML can be done in
KDE. I would kindly ask the l10n-script developers to take a look at
it any maybe integrate it at the proper places, because they know the
code way better than I do.
The scripts can also be found at:
 http://people.freedesktop.org/~mak/appstream/kde-asmetadata-l10n.tar.gz
(I also included a demo XML file there)

If you have questions, please let me know!
Cheers,
    Matthias
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
                break-word;">* Finds AppStream metadata in project source directories
* .pot extraction works
* Merging translation to untranslated files works
* Merging new translation into already translated metadata files works (without \
                duplicating entries)
* Resulting files are valid AppStream metadata files (compliance-check passed)
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>trunk/l10n-kde4/scripts/merge_metainfo.sh <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>trunk/l10n-kde4/scripts/extract_metainfo.sh <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>trunk/l10n-kde4/scripts/as-metainfo.its <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>trunk/l10n-kde4/scripts/update_translations <span style="color: \
grey">(1384853)</span></li>

</ul>

<p><a href="https://svn.reviewboard.kde.org/r/7106/diff/" style="margin-left: \
3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic