Closed marlass closed 5 years ago
Thanks a lot for the PR, @marlass!
For the parameter names: i see how this is not that simple, but i'd still refrain from generating parameter names like param1
- IMO those are not really user-friendly.
Here's my suggestion:
user.male ? "Mr" : "Mrs"
could become userMaleMrMrs
. This is not always optimal but the user can still change it. Also make sure that we don't generate the same parameter name twice for a given string.Hello text: {userMale}(user.male ? 'Mr' : 'Mrs') {userName}(user.name)
What do you think?
That solution make sense. I will hack on it later this week.
@marlass I took your changes and worked on them and they made it into 1.1.0
. Thank you so much for your work!
I decided to use a solution quite similar to yours now, fell free to check it out.
Looks good. Thanks for finishing it and sorry for leaving it in uncompleted state. Glad it landed in new version.
Added support for parameters in translations. Unfortunately, solution presented in issue could not be done. There is a problem with naming parameters. User could provide in each language different names and that cannot be resolved automatically. So I decided just to names these params automatically:
param[$i]
. With this we always provide every interpolated data to be used in translation and user can later rename them in template file to his needs.Should close #4