Bug 39623

Summary: [EasyHack] Export/Import .src comments to .sdf/.po format
Product: LibreOffice Reporter: Björn Michaelsen <bjoern.michaelsen>
Component: LibreOfficeAssignee: Andras Timar <timar74>
Status: RESOLVED FIXED    
Severity: normal CC: robinson.libreoffice, timar74
Priority: medium Keywords: easyHack, skillCpp
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:

Description Björn Michaelsen 2011-07-28 07:42:31 UTC
=== Export/Import .src comments to .sdf/.po format ===

Our translations system has .src files in a custom format where developers add strings that need to be translated.

Translations are stored in .sdf files and there are various tools to convert these to and from the more normal .po format that translators are typically used to.

.src files can contain comments (x-comment) intended for the end-translator to see, e.g. See http://opengrok.libreoffice.org/xref/components/cui/source/options/optsave.src#221

.po files can also contain comments, but the intermediate .sdf file does not.

Ideally the .sdf format would be able to store these comments, and the po2sdf and sdf2po tools would be made aware of them in order to import/export them.

See l10ntools for the source code to create .sdf files

'''Skills:''' C++

'''Taken by''': [[User:DrDub|DrDub]] (2011/04/18)
Comment 1 Gökçen Eraslan 2012-04-11 10:46:26 UTC
I think correct link is this: http://opengrok.libreoffice.org/xref/core/cui/source/options/optsave.src#234
Comment 2 Björn Michaelsen 2012-04-12 04:41:51 UTC
@Andras: If this EasyHack is still valid, could you mentor or reasign to better suited mentor?
Comment 3 Andras Timar 2012-04-12 04:58:34 UTC
@Björn: yes, it is still valid.
Comment 4 Andras Timar 2012-04-14 05:34:16 UTC
http://cgit.freedesktop.org/libreoffice/core/commit/?id=3f00358bfdad0a18fe053c3d154f74e3aa6afba9

This enables export of comments to en-US sdf file.
Comment 5 Andras Timar 2012-04-14 07:22:57 UTC
With the patch below, oo2po writes the x-comment to a developer comment in pot files. Problem solved.

--- /home/timar/src/translate-toolkit-1.9.0/translate/convert/oo2po.py	2010-08-23 08:45:46.000000000 +0200
+++ /usr/local/lib/python2.7/site-packages/translate/convert/oo2po.py	2012-04-14 16:14:42.305234337 +0200
@@ -75,10 +75,9 @@
             else:
                 # if the language doesn't exist, the translation is missing ... so make it blank
                 part2 = oo.ooline()
-        if "x-comment" in theoo.languages:
-            translators_comment = theoo.languages["x-comment"]
-        else:
-            translators_comment = oo.ooline()
+        line = oo.ooline()
+        line.text = part1.getparts()[11]
+        translators_comment = line
         key = oo.makekey(part1.getkey(), self.long_keys)
         unitlist = []
         for subkey in ("text", "quickhelptext", "title"):
Comment 6 Robinson Tryon (qubit) 2015-12-16 00:41:27 UTC
Migrating Whiteboard tags to Keywords: (EasyHack SkillCpp)
[NinjaEdit]