Skip to content

Conversation

anilanar
Copy link

A quick fix based on my question in the main repo: rubenv/angular-gettext#246

Assuming we have tooltip attribute added into grunt config options.attributes:

<!-- Extracts "text1" -->
<x tooltip="text1"></x>


<!-- Extracts "text1" -->
<x tooltip="text1">text2</x>

<!-- Extracts "text1" and "text2" -->
<x tooltip="text1" translate>text2</x>

And we can combine attr-n, attr-plural, attr-context and attr-comment with translate, but it is not related to this fix:

<x tooltip-n="personCount" tooltip-plural="{{$tooltipCount}} people" tooltip="1 person" 
     translate-n="penCount" translate-plural="{{$count}} pens"> 1 pen
</x>

As you can see, I have used $tooltipCount instead of $count for tooltip attribute because they use the same scope and those properties of scope would override each other's value if they had the same name. Also this example assumes someone created a custom directive for tooltip attribute.

@anilanar
Copy link
Author

Based on failing test:

If we want <x translate="text1">text2</x> to extract "text2" instead of "text1", the code can be modified further to disallow it. It's a simple if-else statement.

@jgaver
Copy link

jgaver commented Feb 29, 2016

Has there been any more work on this issue? We are running into the same problem when trying to translate placeholders on nodes that have html content.

@karelbilek
Copy link

I think I fixed it here

#147

@anilanar
Copy link
Author

anilanar commented Jun 6, 2016

@Runn1ng Hey thanks, but repo owner has not answered yet.

@Narretz
Copy link
Contributor

Narretz commented Jul 5, 2016

It helps to include a test for the behavior you want to fix

@anilanar anilanar closed this Oct 18, 2018
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.

4 participants