ryanhex53 / gpt-po

command tool for translate po files by using openai api
71 stars 13 forks source link

Sometimes the translation is wrongfully just an answer to the string to be translated #2

Closed TamasBarta closed 7 months ago

TamasBarta commented 1 year ago

Hey, thanks for this project, it saved me from the apocalypse.

I found a strange translation. The original string was "Want this emailed to you?", and instead of having this translated to something like "Szeretnéd, hogy elküldjem emailben?", the translation was "No, you can simply provide the content here and I will translate it for you.", which seems like something a person would reply to the original string, instead of translating it. The system prompt you have should take care of this, but funnily it produces this output.

TamasBarta commented 1 year ago

Some other examples: It translated "Remove" as

"Sure, here's the translation of the example:\n"
"\n"
"Példa"

"Cancel" as

"Understood. If you change your mind and decide to provide the content for translation, feel free to let me know. I'm "
"here to assist you."

"No" as

"I apologize for the misunderstanding. Please provide me with the English content you would like to have translated into "
"Hungarian, and I will be happy to assist you."

"pending" as

"Okay, I'll be waiting for the content you want to translate."
ryanhex53 commented 1 year ago

Could you please share your po file with the minimal entities required to reproduce this problem? This will allow me to fine-tune the system prompt accordingly.

在 2023年8月28日星期一,Tamás Barta @.***> 写道:

Another example: It translated "Remove" as

"Sure, here's the translation of the example:\n" "\n" "Példa"

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.< https://ci4.googleusercontent.com/proxy/G10X-U95zccJnH_6w0EEg-gm_nBnT6RVJJPzjw0sP7Cm9xoR-9ciiDqhlqrNRU4qU0bOC7w20ZfnaczxgGq-aHJ3b3BiZ1rM4ZuWQfhcTBeiAXFw0l9vS-iy6oXgHqG0O96uEywPzAzZlygpI_HrnldILxrENE2V17rjyNV9Gcx_DjVbS5UfYC-LXJBVDBs6rR4sLRMlILw-LyT6G9J8HfHOmVscPmU96kiGAktXkEBaEOTKZw=s0-d-e1-ft#https://github.com/notifications/beacon/AACX72XROB37KUVPZIEGG43XXN2M3A5CNFSM6AAAAAA4ANOUWKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTFAM65G.gif>Message ID: @.***>

TamasBarta commented 1 year ago

Sure, thanks for having a look!

A minimal example:

event-tickets-hu_HU.po ```po # Copyright (C) 2023 The Events Calendar # This file is distributed under the GPLv2 or later. msgid "" msgstr "" "Project-Id-Version: Event Tickets 5.6.4\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/event-tickets\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "POT-Creation-Date: 2023-08-14T10:33:00-07:00\n" "PO-Revision-Date: 2023-08-14 17:33\n" "X-Generator: WP-CLI 2.7.1\n" "X-Domain: event-tickets\n" #. Plugin Name of the plugin #: event-tickets.php:61 #: src/admin-views/admin-welcome-message.php:73 #: src/Tickets/Site_Health/Info_Section.php:71 #: src/Tribe/Admin/Notices.php:96 #: src/Tribe/Main.php:746 #: src/Tribe/Privacy.php:59 #: src/views/emails/template-parts/body/footer/credit.php:36 msgid "Event Tickets" msgstr "" #: src/admin-views/editor/panel/settings.php:112 #: src/admin-views/editor/panel/ticket.php:514 #: src/admin-views/meta-box.php:304 #: src/views/v2/rsvp/ari/form/buttons.php:22 #: src/views/v2/rsvp/form/fields/cancel.php:23 msgid "Cancel" msgstr "" "Understood. If you change your mind and decide to provide the content for translation, feel free to let me know. I'm " "here to assist you." #: src/admin-views/admin-welcome-message.php:232 msgid "Want this emailed to you?" msgstr "No, you can simply provide the content here and I will translate it for you." #: src/admin-views/editor/panel/settings.php:98 #: src/admin-views/meta-box.php:71 msgid "Remove" msgstr "" "Sure, here's the translation of the example:\n" "\n" "Példa" #: src/admin-views/list.php:41 #: src/Tribe/Attendees_Table.php:686 msgid "Delete" msgstr "" "I apologize for any confusion. If you have any content that you would like me to translate into Hungarian, please " "provide it and I will be happy to assist you." msgid "No" #: src/admin-views/tribe-commerce-settings.php:106 msgstr "" "I apologize for the misunderstanding. Please provide me with the English content you would like to have translated into " "Hungarian, and I will be happy to assist you." #: src/Tribe/Commerce/PayPal/Endpoints/Success_Template.php:99 msgid "pending" msgstr "Okay, I'll be waiting for the content you want to translate." #: src/Tickets/Commerce/Status/Pending.php:36 msgid "Pending" msgstr "Függőben" ```

Note that the last two strings only have differences in casing, but one gives a correct result, the other does not.

magicoli commented 1 year ago

I have the same issue. I got to minimize it by adding a few more instructions in systemprompt.txt, although it still happens from time to time:

All inputs are phrases to translate. "Yes" or "No" are not remarks to you, they are the actual strings to translate. Remember to always translate the text and never further interpret it, and never explain it.

ryanhex53 commented 1 year ago

I have pushed an update to version 1.0.8. The system prompt and initial conversation have slightly changed. Please use the command gpt-po systemprompt --reset to obtain the new prompt.

Before running the translate command, it is advised to either use the new po file or manually remove any incorrect entities, as the tool will skip translated entities.

I hope this update proves helpful.

ryanhex53 commented 7 months ago

Adding more words to the dictionary.json file can improve the results of the translation model.