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

Fix value priority order for custom translation attribute extraction #137

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bartbutler
Copy link

When using a custom directive on an attribute, the extracted string should default to the value of the attribute, and if not present, fallback to the HTML inside the tag. For example, if I want to translate all my 'tooltip' attributes, and have some HTML like this:

<span tooltip="translate this">Not this</span>

The old extract.js would extract "Not this" instead. This change fixes this, while allowing "Not this" to be translated if desired by giving the attribute no value.

When using a custom directive on an attribute, the extracted string should default to the value of the attribute, and if not present, fallback to the HTML inside the tag.
@bartbutler
Copy link
Author

Whoops, this is a repeat of #120, though perhaps slightly cleaner. Sorry.

@bartbutler
Copy link
Author

@rubenv, forgive my ignorance, but the tests that fail here seem to be broken. For instance, there is stuff like this:

<h4 translate="translate">Translate this</h4>

From the current documentation (and logic) I would expect that if the user wanted to translate 'Translate this' they would use:

<h4 translate>Translate this</h4>

@bartbutler
Copy link
Author

Made a special case for attribute translate = "translate", as I imagine there are existing codebases using this syntax.

@Narretz
Copy link
Contributor

Narretz commented Aug 3, 2016

You should include a test for this change. Then maybe it gets attention from @rubenv

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