translate icon indicating copy to clipboard operation
translate copied to clipboard

Add support for monolingual output in resx2po

Open GioviQ opened this issue 4 years ago • 8 comments

I a trying to convert a bunch of resx files.

E.g. Strings.resx Strings.it.resx

The output is: Strings.po with #: InserireTessera msgid "Insert card" msgstr ""

It should be: #: InserireTessera msgid "InserireTessera" msgstr "Insert card"

Strings.it.po #: InserireTessera msgid "Inserire tessera" msgstr ""

It should be: #: InserireTessera msgid "InserireTessera" msgstr "Inserire tessera"

If msgids do not match the output is useless.

GioviQ avatar Aug 22 '21 06:08 GioviQ

Any progress on this? I have the same problem.

danielklecha avatar Aug 04 '22 11:08 danielklecha

@danielklecha I used https://github.com/GioviQ/resgenEx

GioviQ avatar Aug 04 '22 14:08 GioviQ

The correct usage is:

resx2po -i  Strings.it.resx -t  Strings.resx -o it.po

nijel avatar Aug 10 '22 09:08 nijel

@nijel I got different output but it's still wrong. I have resx generated by VS2022 and I want to convert it to PO file. Part of the resx file:

<data name="RegisterAsNewUser" xml:space="preserve">
  <value>Register as a new user</value>
</data>

Command:

resx2po -i Areas.Identity.Pages.Account.Login.resx -t Areas.Identity.Pages.Account.Login.resx -o Areas.Identity.Pages.Account.Login.en.po

Part of the po file:

#: RegisterAsNewUser
msgid "Register as a new user"
msgstr "Register as a new user"

There should be key in msgid but it contains value.

danielklecha avatar Aug 11 '22 09:08 danielklecha

No, there should be the srouce string in the msgid, gettext is bilingual format here.

nijel avatar Aug 11 '22 09:08 nijel

@nijel Oh... Ok. I use different convention... You use english sentences as key, so you don't need en.po file. I use keys with cammel case, so I need en.resx or en.po files.

I cannot use you tool but everything is working correctly with bilingual format.

danielklecha avatar Aug 11 '22 11:08 danielklecha

resx2po can certainly be extended to support format you need, patches are welcome :-).

nijel avatar Aug 15 '22 09:08 nijel

it's possible to add the context with msgctxt instead of placing it as a comment with #:

<data name="RegisterAsNewUser" xml:space="preserve">
  <value>Register as a new user</value>
</data>
msgctxt "RegisterAsNewUser"
msgid "Register as a new user"
msgstr "Register as a new user"

jraby-adoria avatar Aug 26 '22 14:08 jraby-adoria