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

DeepL target_lang for EN-GB and EN-US #738

Closed
unreadableusername opened this issue Nov 6, 2023 · 3 comments
Closed

DeepL target_lang for EN-GB and EN-US #738

unreadableusername opened this issue Nov 6, 2023 · 3 comments

Comments

@unreadableusername
Copy link

unreadableusername commented Nov 6, 2023

The DeepL API documentation specifies to use EN-GB or EN-US to archieve the desired translation, however following code in the deepl.py will chop off the -GB or -US and the deprecated unspecified route will be used.

def language_code(code, is_target=False):
    # DeepL supports targeting Brazillian Portuguese but doesn't have this for other languages
    if is_target and code in ["pt-pt", "pt-br"]:
        return code
    return code.split("-")[0].upper()

I suggest to add en-gb and en-us to the array inside the if statement above to respect users desired locale setting.
Please tell me if this is shortsightet or more complicated then this 😅

@zerolab
Copy link
Collaborator

zerolab commented Nov 6, 2023

@unreadableusername I think the note on target_lang - "EN - English (unspecified variant for backward compatibility; please select EN-GB or EN-US instead)" is fairly clear. We should follow the advised approach. Do you have the capacity to submit a PR?

@enzedonline
Copy link
Contributor

You'll get me started on a rant about EN being taken to mean EN-US when US English is a dialect of English only used in parts of North America 😂. European (and more) sites that use EN mean international English which definitely is not US English. It's a bit like using FR and getting Quebecois instead.

I've always thought there should be a configurable default locale when using language codes. Having to specify something like EN-GB in the url to get non-American English makes no sense and makes the reader it's something UK specific.

@zerolab
Copy link
Collaborator

zerolab commented Nov 15, 2023

Added tests and merged in a3efa8f
Thank you

@zerolab zerolab closed this as completed Nov 15, 2023
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

Successfully merging a pull request may close this issue.

3 participants