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

Added translate="no" logic #200

Closed
wants to merge 1 commit into from
Closed

Conversation

rleshchenko
Copy link

@rleshchenko rleshchenko commented Jul 30, 2019

What?

Logic to exclude translate="no" tags from extract command scope

Why?

So far google chrome supports translate="no" attribute for the content which is not going to be translated by automatic google translate plugin or any other translation. In this PR you can find a logic to do such a thing. Proof:
https://cloud.google.com/translate/faq#technical_questions

Testing / Proof

Run gulp gettext:extract on the template with the translate="no" attribute

ping @rubenv

@rubenv
Copy link
Owner

rubenv commented Aug 1, 2019

Excluding strings from extraction won't stop them from being handled by the runtime code. I recommend that you use the class="notranslate" method when using angular-gettext.

I'm hesitant to include this as it might break existing code. Please also include a unit test with pull requests.

@rleshchenko
Copy link
Author

Excluding strings from extraction won't stop them from being handled by the runtime code. I recommend that you use the class="notranslate" method when using angular-gettext.

I'm hesitant to include this as it might break existing code. Please also include a unit test with pull requests.

But still, this attribute is very common. The current implementation makes impossible correct behaviour of applications already marked with such a tag. I will create tests and fix for runtime code and ping you then

@rubenv
Copy link
Owner

rubenv commented Aug 2, 2019

The current implementation makes impossible correct behaviour of applications already marked with such a tag.

Yes you can: replace every translate="no" with class="notranslate".

@rleshchenko
Copy link
Author

The current implementation makes impossible correct behaviour of applications already marked with such a tag.

Yes you can: replace every translate="no" with class="notranslate".

But notranslate won't be recognized with plugins for a browser or automated translation from google. But translate="no" does. That's a thing

@rubenv
Copy link
Owner

rubenv commented Aug 2, 2019

It's right there in the link you gave (https://cloud.google.com/translate/faq#technical_questions):

How do I tell Cloud Translation API to NOT translate something?

You can use the following HTML tags:

    <span translate="no"> </span>
    <span class="notranslate"> </span>

This functionality requires the source text to be submitted in HTML.

@rleshchenko
Copy link
Author

It's right there in the link you gave (https://cloud.google.com/translate/faq#technical_questions):

How do I tell Cloud Translation API to NOT translate something?

You can use the following HTML tags:

    <span translate="no"> </span>
    <span class="notranslate"> </span>

This functionality requires the source text to be submitted in HTML.

Oh, sorry, my bad, didn't see that notranslate there. So there is no way to support both attribute and class?

@rubenv
Copy link
Owner

rubenv commented Aug 2, 2019

Well, I'd rather not introduce any (potentially breaking) changes if there's an alternative solution. As per rubenv/angular-gettext#365, this project is in maintenance mode.

Whatever changes land now cannot break any existing applications, even if the risk is small.

@rleshchenko
Copy link
Author

@rubenv, thank you then. Will close PR and proceed with current implementation

@rleshchenko rleshchenko closed this Aug 2, 2019
@rubenv
Copy link
Owner

rubenv commented Aug 2, 2019

Will close PR and proceed with current implementation

Good luck! Feel free to follow-up if things don't work out.

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 this pull request may close these issues.

2 participants