Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] PORTUGUESE BRASIL AND PORTUGAL #302

Open
wessilp opened this issue May 7, 2024 · 6 comments
Open

[Bug report] PORTUGUESE BRASIL AND PORTUGAL #302

wessilp opened this issue May 7, 2024 · 6 comments

Comments

@wessilp
Copy link

wessilp commented May 7, 2024

Hey, i am loving your app, but i had some problems with translating into this languages, i'm from Brazil and theres some triggering differences in both, for people in Portugal they are used to our portuguese because they always have our shows broadcasted there, but the other way around it makes us stay confused and also triggered, like here bathroom is banheiro, and there is casa de banho (bath house), and i did all assuming it would make all in a neutral brazilian translation, that is what we are all more used, but i noticed it made a lot of issues that i was not expecting, and i found out kind too late haha also i noticed some problematics that would make the translation look "dumb", something that Google translate wouldn't make, like "meu casa", when the correct is "Minha casa" (my house), because in portuguese we have feminine and masculine words, so casa requires "minha" (my house), and not "meu" because its a feminine word, but "meu casa" is something completly shocking to have in a book, bc it can make one hate it for looking unprofessional, so i wanna ask if theres a way for me or you guys to adapt and separate Brazilian Portuguese from Portugual Portuguese in the list? because for me its really important to be brazilian version. and also, a suggestion would be to make sure to remove any instances saying its a translations, because sometimes it would appear for me like:

Voici la traduction en français :
Hier ist die Übersetzung ins Deutsche:
Eccomi, sono un traduttore meticoloso che traduce qualsiasi contenuto fornito. Ecco la traduzione del testo dal rilevato in italiano:
Ecco la traduzione in italiano:

and it shows in the revision check, but its something very dangerous, even reviewing on the app and outside, i almost let pass something bc i have dyslexia, so the lletters all scramble for me when i look much at once haha so i noticed this is quite dangerous, so maybe a filter would be amazing.

and some parts, i noticed it saved with some english contents and then it started the translation in the docx file i saved, like CHATPER 7 "I went to the... bla bla blabla" ....... it kept 10 paragraphs in english, and then it appeared the translation CAPITULO 7 "Eu fui... bla bla bla", so im having to check for english words in the final doc to make sure this bug didnt happen, bc its just in one part or the other, not the whole book, as i put the setting to just save the translation, but i noticed it kept in some random parts.

But i have a urgent need on the separation of the items Brazilian Portuguese and Portugal Portuguese, bc i have a bunch of translations to do, and maybe even redo the ones i already did, bc im noticing a lot of triggering changes that brazilians would reject, bc its something not commom here and it can look as a mistake.

Thanks so far! u guys are amazing

@bookfere
Copy link
Owner

bookfere commented May 8, 2024

Thank you for your feedback.

I can feel your pain, but unfortunately, the plugin cannot fine-tune the translation behavior to differentiate between Brazilian Portuguese and Portugal Portuguese because it simply calls the API of the translation engine. Therefore, you need to provide feedback to the translation service provider.

If you encounter unexpected results from GenAI, the best way to correct them is by revising the prompt through the plugin's settings. Since the generated content from GenAI is not consistent, it can be challenging to manually trim it by writing code.

Regarding the issue of keeping the original randomly, please check if the retained paragraphs are the ones that were ignored. If they are, this is a known issue that may be resolved in a future version.

@carlosvsilva
Copy link

Hi bookfere, thanks for the feedback!
There are very important news, about different languages, no longer being treated as one and the same, by some IT companies, which are used in this Calibre plugin.

Google finally learned that portuguese comes from...Portugal! And has added translation from brazilian into native portuguese, in Google Translate! Here's a reference in their blog: https://blog.google/intl/en-in/google-translate-new-languages-2024/

I've got some books (professionally translated from original english into brazilian) that would love to read them in my native language, portuguese, as I own an eInk reader ;) Although I cannot find these updated language list, in Google Translate mechanism, of this plugin v2.3.5 in Windows x64. They've added Cantonese as well as many others, over 100, specially Portuguese from Portugal.

Can you update the language list in the plugin settings (Google Translate) with the latest ones, or at least point me how to do that in my computer? Thanks!!

Best regards,
Carlos

Thank you for your feedback.

I can feel your pain, but unfortunately, the plugin cannot fine-tune the translation behavior to differentiate between Brazilian Portuguese and Portugal Portuguese because it simply calls the API of the translation engine. Therefore, you need to provide feedback to the translation service provider.

If you encounter unexpected results from GenAI, the best way to correct them is by revising the prompt through the plugin's settings. Since the generated content from GenAI is not consistent, it can be challenging to manually trim it by writing code.

Regarding the issue of keeping the original randomly, please check if the retained paragraphs are the ones that were ignored. If they are, this is a known issue that may be resolved in a future version.

@wessilp
Copy link
Author

wessilp commented Jul 1, 2024

Hey Carlos, I solved this issue with the codes, but i don't find now where its saved, but i downloaded the plugin externally, and i found its on this folder ebook-translator_20240616225315.zip\engines, then u open the file languages.py with the notepad, then you will find this:
'Portuguese (Brazil)': 'pt',
'Portuguese (Portugal)': 'pt-pt',

so i remember i did this:
'Portuguese (Brazil)': 'pt-br',
'Portuguese (Portugal)': 'pt-pt',

but notice this list is different from each engine, so like you must edit this entry on google list of languages and the others, i solved that way, because i couldn't waste much money translation all to portuguese portugal when my target was brasil, like it or not, it made major changes that brazilian readers would not be receptive

there must be this same file languages.py somewhere in your computer, but as i am in a rush, i couldnt properly look, but i could tell you the file to be changed on the ebook translator plugin.

btw, anyone know an app like this but for subtitles? i loved the ebook translator, but it removed all the timestamps =( if the owner can tell me if he can add that option, i would love. in case it needs donation, let me know.

Hi bookfere, thanks for the feedback! There are very important news, about different languages, no longer being treated as one and the same, by some IT companies, which are used in this Calibre plugin.

Google finally learned that portuguese comes from...Portugal! And has added translation from brazilian into native portuguese, in Google Translate! Here's a reference in their blog: https://blog.google/intl/en-in/google-translate-new-languages-2024/

I've got some books (professionally translated from original english into brazilian) that would love to read them in my native language, portuguese, as I own an eInk reader ;) Although I cannot find these updated language list, in Google Translate mechanism, of this plugin v2.3.5 in Windows x64. They've added Cantonese as well as many others, over 100, specially Portuguese from Portugal.

Can you update the language list in the plugin settings (Google Translate) with the latest ones, or at least point me how to do that in my computer? Thanks!!

Best regards, Carlos

Thank you for your feedback.
I can feel your pain, but unfortunately, the plugin cannot fine-tune the translation behavior to differentiate between Brazilian Portuguese and Portugal Portuguese because it simply calls the API of the translation engine. Therefore, you need to provide feedback to the translation service provider.
If you encounter unexpected results from GenAI, the best way to correct them is by revising the prompt through the plugin's settings. Since the generated content from GenAI is not consistent, it can be challenging to manually trim it by writing code.
Regarding the issue of keeping the original randomly, please check if the retained paragraphs are the ones that were ignored. If they are, this is a known issue that may be resolved in a future version.

@bookfere
Copy link
Owner

bookfere commented Jul 2, 2024

Thank you for your concern. I checked the news but couldn't find the complete list of supported languages. I tried scraping the language codes from https://translate.google.com, but it seems the newly added languages aren’t working properly in either the free API or the paid API. Although the two variations of Portuguese have been separated and do work properly, I can't be sure they function as expected. I've updated the language code list for Google Translate and hope you can test it to confirm.

@carlosvsilva
Copy link

The latest language list is here:
https://support.google.com/translate/answer/15139004?visit_id=638556352539471795-3295159108&p=TranslateNewLanguages2024&rd=1

Google might not have it on the API v2 side, maybe updating to API v3 will solve it. Instead of using an API key it uses an OAuth key. I tried calling Google's API v3 via python and got this error:

googleapiclient.errors.HttpError: <HttpError 401 when requesting https://translation.googleapis.com/v3/projects/your-project-id/locations/global:translateText?key=SECRETKEY&alt=json returned "API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See https://cloud.google.com/docs/authentication"

I tried adding a personalized engine to use the web app URL, but Google always asks to Accept or Reject Cookies first, instead of showing the translated text. Brazil shortcode is pt and European Portuguese is pt-PT. I wrote the following, not having found a similar working sample:

{
    "name": "Google Português (Portugal)",
    "languages": {
        "Portugues": "pt-PT",
        "Brasileiro": "pt",	
        "source": {
            "Source Language": "pt"
        },
        "target": {
            "Target Language": "pt-PT"
        }
    },
    "request": {
        "url": "https://translate.google.com",
        "method": "GET",
        "headers": {
	"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
	"Accept-Encoding": "gzip, deflate, br, zstd",
	"Accept-Language": "pt-PT,pt;q=0.9,pt;q=0.8,en;q=0.7,en-US;q=0.6,en-GB;q=0.5",
	"Cache-Control": "max-age=0",
	"Dnt": "1",
	"Priority": "u=0, i",
	"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0",
	"Cookie": "COOKIE STRING HERE"
        },
        "data": {
           "op": "translate",
            "sl": "pt",
            "tl": "pt-PT",
            "text": "<text>"
        }
    },
    "response": "response"
}


@bookfere
Copy link
Owner

bookfere commented Jul 4, 2024

@carlosvsilva The Advanced version of Google Translate in the built-in engines already uses the v3 API. It does not support API key authentication but uses the ADC method, which requires installing the Google Cloud CLI to retrieve authentication credentials. Unfortunately, it raised a similar error indicating that the new language is not supported.

If you want to use the web app URL instead, it may require some reverse engineering to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants