po-xls icon indicating copy to clipboard operation
po-xls copied to clipboard

Can keep .po file comments ?

Open XHXIAIEIN opened this issue 3 years ago • 4 comments

Currently, if convert to Excel, and converted back from a PO-file, all the comment information will disappears. I wish they could keep them all in new PO-file .

XHXIAIEIN avatar Feb 05 '22 07:02 XHXIAIEIN

It should keep comments. See https://github.com/wichert/po-xls/issues/12 Can you post an example? Where does it get lost? When converting from Excel to po?

JensMertelmeyer avatar Feb 07 '22 13:02 JensMertelmeyer

Yes. When converting from Excel to po.

Step1:source.po

#: main.caption
msgid "Happy New Year"
msgstr ""

#: main.btnok.caption
msgctxt "main.btnok.caption"
msgid "OK"
msgstr ""

#: main.btnnext.caption
msgctxt "main.btnnext.caption"
msgid "Next"
msgstr ""

#: main.btnback.caption
msgctxt "main.btnback.caption"
msgid "Back"
msgstr ""

#: main.password.hint
msgid "Almost before we knew it, we had left the ground."
msgstr ""

#: main.password.text
msgid "2022"
msgstr ""

#: main.label1.caption
msgid "Password"
msgstr ""

Step2:command

 po-to-xls -o texts.xlsx -c reference source.po

Step3:texts.xlsx

Message context Message id References source
  Happy New Year main.caption 新年快乐
main.btnok.caption OK main.btnok.caption 确定
main.btnnext.caption Next main.btnnext.caption 继续
main.btnback.caption Back main.btnback.caption 返回
  Almost before we knew it, we had left the ground. main.password.hint 几乎在我们意识到之前,我们已经离开了地面。
  2022 main.password.text 2022
  Password main.label1.caption 输入密码

Step4:command

xls-to-po source texts.xlsx export.po

Step5:export.po

# This file was generated from texts.xlsx
msgid ""
msgstr ""
"PO-Revision-Date: 2022-02-07 22:25+0800\n"
"Language: source\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: xls-to-po 1.0\n"

msgid "Happy New Year"
msgstr "新年快乐"

msgctxt "main.btnok.caption"
msgid "OK"
msgstr "确定"

msgctxt "main.btnnext.caption"
msgid "Next"
msgstr "继续"

msgctxt "main.btnback.caption"
msgid "Back"
msgstr "返回"

msgid "Almost before we knew it, we had left the ground."
msgstr "几乎在我们意识到之前,我们已经离开了地面。"

msgid "2022"
msgstr "2022"

msgid "Password"
msgstr "输入密码"

expected

so, I would prefer it to be this way:

#: main.caption
msgid "Happy New Year"
msgstr "新年快乐"

#: main.btnok.caption
msgctxt "main.btnok.caption"
msgid "OK"
msgstr "确定"

#: main.btnnext.caption
msgctxt "main.btnnext.caption"
msgid "Next"
msgstr "继续"

#: main.btnback.caption
msgctxt "main.btnback.caption"
msgid "Back"
msgstr "返回"

#: main.password.hint
msgid "Almost before we knew it, we had left the ground."
msgstr "几乎在我们意识到之前,我们已经离开了地面。"

#: main.password.text
msgid "2022"
msgstr "2022"

#: main.label1.caption
msgid "Password"
msgstr "输入密码"

XHXIAIEIN avatar Feb 07 '22 14:02 XHXIAIEIN

I have the same problem

hansu avatar Apr 02 '22 15:04 hansu

I have created https://github.com/wichert/po-xls/pull/26 which fixes this issue.

Before (even if) this will be merged it is possible to install po-xls from my fork with: pip install git+https://github.com/zbyna/po-xls.git#egg=poxls

zbyna avatar May 26 '22 00:05 zbyna