-
Notifications
You must be signed in to change notification settings - Fork 52
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
Support the translate-namespace directive #78
Comments
+1 |
Diving a bit more into the grunt-angular-translate code, it turns that supporting the directive isn't that easy. Not because of grunt-angular-translate itself, but because of the occurring problems when using regular expressions in connection with html-tags. Assuming the following code ( <ANY translate-namespace="MY.NAMESPACE.">
<span translate="BAR"></span>
<span translate="FOO"></span>
</ANY> Easy task using regex and searching between {
"MY": {
"NAMESPACE": {
"BAR": "...",
"FOO": "..."
}
}
} But what about the following example? <div translate-namespace="MY.NAMESPACE.">
<div>
<span translate="BAR"></span>
</div>
<span translate="FOO"></span>
</div> Now it gets heavy, because we can't just searching between However, a quick (maybe bad?) solution would be using kind of a "closing" html comment like: <div translate-namespace="MY.NAMESPACE.">
<div>
<span translate="BAR"></span>
</div>
<span translate="FOO"></span>
</div> <!-- translate-namespace-end="MY.NAMESPACE." --> Perhaps it's messy, but it makes the job lots of easier. |
I could come up with a pull request, if wanted. Anybody who comes across the same issue can clone my fork and checkout to this branch: Usage as described above: <div translate-namespace="MY.NAMESPACE.">
<div>
<span translate="BAR"></span>
</div>
<span translate="FOO"></span>
</div> <!-- translate-namespace-end="MY.NAMESPACE." --> |
Namespaces are supported by grunt-angular-translate, but not the https://angular-translate.github.io/docs/#/api/pascalprecht.translate.directive:translateNamespace directive. The
translate-namespace
directive allows a developer to avoid repeating the namespace in a view by extracting it to a parent element.That is, given the following example:
Expected:
Actual:
The text was updated successfully, but these errors were encountered: