aaemnnosttv / wp-cli-login-command

Log in to WordPress with secure passwordless magic links.
https://aaemnnost.tv/wp-cli-commands/login/
MIT License
292 stars 47 forks source link

Email i18n #31

Closed tersor closed 4 years ago

tersor commented 4 years ago

Hello.

What a great plugin this is! It would have been nice to be able to translate the email, especially the subject field. Probably not necessary for the mustache template, huh?

aaemnnosttv commented 4 years ago

Hi there, and thanks for the kind words!

I agree, translation would be great, and not something that was considered initially. I think for now, your best bet is to copy the mustache template and translate it in the copy. Then you can pass the alternate template as an argument to wp login email <user> --template=<path-to-template-file>.

You can update the default by setting this in your wp-cli.yml or global config file like so

login email:
  template: path/to/alternate/template.mustache

Let me know if/how that works for you or if you have any other questions or suggestions.

tersor commented 4 years ago

Yes, the email body can be translated like you describe, works great! But how about the email subject?

aaemnnosttv commented 4 years ago

Oh! My mistake. You're right, there's currently no way to translate that. How about a new parameter to the email command?

Would this work for you?

wp login email <user> --subject='Alternate subject for login to {{domain}}' --template=...
tersor commented 4 years ago

That would work perfect!

aaemnnosttv commented 4 years ago

Great! I'll plan on adding this soon unless you'd like to submit a PR yourself?

tersor commented 4 years ago

Sure, I can try to submit a PR, thanks!