-
Notifications
You must be signed in to change notification settings - Fork 1
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 for transpiling arbitrary content #18
Comments
Hi @joonashak, thanks for suggestion. I can see the value in having your content be rendered also using these transpilers and do think it would be nice addition to the library. I'm doubting whether it makes sense to add it to the |
Yeah, I think this is probably the way to go, too. From a semantic point of view, it would be kind of funny to see something like If you'd like, I can help out with the implementation. I'm able to use some working hours for this, so you don't have to do it all on your free time :) |
I've given it some thought. Although my first intuition to create separate component for this use case initially seemed like a good idea, I now no longer feel that is the right approach. Reason being is that it will still depend on Transloco for the string interpolation (unless the default string interpolation transpiler is overridden) and the transpilation process also requires a translation dictionary. The latter isn't something that can be dropped. Based on this I am more inclined to extend the <transloco [value]="'[i]Test:[/i] [b]{{ BASIC.TITLE }}[/b]'" /> The result is the following (using the English translations):
This might be okay for your use case. If not, you'll have to provide a custom string interpolation transpiler that doesn't make use of Transloco. |
Sounds very good! You already have an implementation for this after your tests or should I open a PR? |
Yeah, I already have an implementation. Just need to add a unit test for it and make a release. Will do that later today. |
Ok, I just released version 5.1.0 which adds the |
Thank you very much, how wonderful! Owe you one 💪 |
No problem! Hope this new feature is working out well for you. Cheers |
We are using
transloco
andngx-transloco-markup
with a set of custom transpilers that handle some HTML tags found in our translation values. However, we also have content sourced from a database that makes use of the same set of HTML tags and it would seem prudent to use the same transpilers for that, too.Would you be willing to accept a PR where I add an input property to the
<transloco>
component that allows passing in arbitrary content for transpilation as an option to using thekey
prop? The content could be just a string or perhaps an object with language code as keys.I realize this might be slightly out of scope for this library, but on the other hand it would not interfere with anything, either. And there could be a marginal general use case, as such a prop might sometimes be handy for quick testing, etc.
Please let me know what you think about this. And big thanks for a solid library - I've really enjoyed using it and your blog text about transpilation, too! 🖖
The text was updated successfully, but these errors were encountered: