-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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 passing of attributes from translation i.e. <0 href="web address"></0> to react component i.e. <a></a> #1117
Comments
I don’t know exactly what you want to do... |
Well that is exactly what I don't want to do. While I have those versions in my files as well, they require me to specify a) how many t()s I will be adding and then I need to implement them as well. What I am after is if I have the following code:
Where list is a translation object returned by
Then Trans will substitute
So given the language translation above I would have to write Does this make more sense? |
attributes inside |
Ok naive question here maybe. Why would you have to map it? Couldn't you just parse it and provide as ...? If not is there a way to know which substitution is currently being made? So I can have a secondary array with the links separatly and add them as properties then via t? |
Open to a PR...? |
I'm not sure what you are asking? |
If you like something supported - provide a pull request for it. Else work with the options you have. |
Wow so nice 😂 - thanks for your help! |
Look...I can understand your feature request and you think it is simple to add. So why not creating a PR to help others in the future having the same request? |
Because although I am versed in many languages, javascript and ES2015 just isn't my home. Having said that it seems that all that needs doing is adding |
This is because of React... This article is a great starting point for people confused in this matter: https://reactjs.org/docs/thinking-in-react.html My advice: If you like to see this feature land, take the chance and learn React... |
I am currently building a webpage with multi language support with extensive language files and numerous inline links that I like to add with component. In some cases, I have multiple links within a single component. I think for readability it would be great if I could just add the attribute to a given <0></0> replacement component.
For example take the following translation file:
With a component as follows:
which I would like to result in:
As I am using a loop I don't want to use the more standard way of having the text within the Trans component but just want to add the <0></0> counters into my many language files.
I don't think the passing of attributes is currently possible, or rather I haven't figured it out. I don't think it would be too difficult to implement. Would it be possible to have such a functionality?
The text was updated successfully, but these errors were encountered: