Skip to content
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

Translation of the alert error when disconnecting from the session : "Your password was changed in another browser session. Please login again using the new password." #5359

Merged
merged 5 commits into from
Oct 31, 2023

Conversation

dimer47
Copy link
Contributor

@dimer47 dimer47 commented Oct 30, 2023

Translation of the alert error when disconnecting from the session : "Your password was changed in another browser session. Please login again using the new password."
CleanShot 2023-10-30 at 21 33 44

WHY

BEFORE - What was wrong? What was happening before this PR?

The translation of the text was not managed, and the text was only in Englis. Additionally, the text could not be changed by translation override.

AFTER - What is happening after this PR?

The text is translated in the language files with the backpack::base.error-login key which allows it to be modified if necessary by overriding the translations.

The translation of the message was done by default for all other languages, respecting the basic message in English.

HOW

How did you achieve that, in technical terms?

I put the text in the translation files and replace the text with its translation key in the src/app/Http/Middleware/AuthenticateSession.php file. I chose the translation key backpack::base.error-login.

Is it a breaking change?

No, this is a minor, imperceptible change intended to improve the user experience when using Backpack for applications in native languages other than English (🇫🇷 France in my case).

How can we test the before & after?

Get the patch from my commit and apply it to an installation of Backpack in a Laravel project.
There are no dependencies with other repo as part of this PR.

…"Your password was changed in another browser session..."
@welcome
Copy link

welcome bot commented Oct 30, 2023

BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly.

Please keep in mind that:

  • if this constitutes a breaking change, it might take quite a while for this to get merged; we try to emulate the Laravel release cycle as much as possible, so developers can upgrade both software once; this means a new big release every ~6 months;
  • even if it's a non-breaking change, it might take a few days/weeks for the PR to get merged; unless it's a no-brainer, we like to have some community feedback on new features, before we merge them; this leads to higher-quality code, in the end; we learnt this the hard way :-)
  • not all PRs get merged; sometimes we just have to hold out new features, to keep the packages lean; sometimes we don't include features that only apply to niche use cases;
  • we're not perfect; if you think we're wrong, call us out on it; but in a kind way :-) we all make mistakes, best we learn from them and build better software together;

Thank you!

--
Justin Case
The Backpack Robot

@phpfour
Copy link
Contributor

phpfour commented Oct 31, 2023

Hey @dimer47

Thanks for the PR. Two small suggestions:

  • The convention in the language files is to use snake_case keys using underscore, so let's not use dashes: error-login
  • The key error-login seems too generic for this case, how about something more specific like password_changed ?

Cheers

@dimer47
Copy link
Contributor Author

dimer47 commented Oct 31, 2023

Thank you for your feedback @phpfour. I've made the changes to respect snake_case conventions and to improve the clarity of the key.

@phpfour
Copy link
Contributor

phpfour commented Oct 31, 2023

Hey @dimer47,

Thanks for addressing the suggestions! Before I merge this, can you fix the formatting issues in some of the files?

CleanShot 2023-10-31 at 15 20 28@2x

Cheers

@pxpm
Copy link
Contributor

pxpm commented Oct 31, 2023

Hey guys, I totally agree with what you are doing here. Let's finish this up and merge it 🙏

I would like also to add that I dislike that error message from the start. It's misleading in some scenarios, and I don't think we need/should be that specific on a session error.

I propose we make it more general and change the message to: Your session has expired. Please login again into your account. and update the translation key to session_expired_error

What you think @dimer47 @phpfour ?

Cheers

@phpfour
Copy link
Contributor

phpfour commented Oct 31, 2023

Hey @pxpm, thanks for chiming in here!

To be honest, I was a bit skeptical seeing the password mentioned in the error message, but I thought maybe it was from a real use case that I was not aware of.

If that's not the case, then I'm definitely in favor of making it generalized as you suggested.

@dimer47
Copy link
Contributor Author

dimer47 commented Oct 31, 2023

Hi @pxpm @phpfour,

I agree that the default message is not very adequate and that it should be more general.

Given that it can be overridden in laravel translations, I simply took the message already entered and translated it.

However, if everyone is ok @tabacitu @pxpm @phpfour, I am also in favor of @pxpm's proposal: session_expired_error: "Your session has expired. Please login again into your account"

Based on feedback, I will make changes.

@pxpm
Copy link
Contributor

pxpm commented Oct 31, 2023

I think we can do that change @dimer47.
@phpfour already vouched for it too and @tabacitu trust us (I think 🙃 ) to make this decision.

Let's do it and merge this 💪

@dimer47
Copy link
Contributor Author

dimer47 commented Oct 31, 2023

@pxpm I just made the change, it's good now. 👍

@pxpm
Copy link
Contributor

pxpm commented Oct 31, 2023

Thanks @dimer47 and @phpfour !

Nice collaboration here 🙏

Cheers

@pxpm pxpm merged commit fa64c2e into Laravel-Backpack:main Oct 31, 2023
2 checks passed
Copy link

welcome bot commented Oct 31, 2023

WHOOP-WHOOP! Congrats, your first PR on this repo has officialy been merged.

party

You should also receive an email inviting you to the Community Members team. That's where we, commited community members, debate new features and decide what's in the Backpack roadmap. Feel free to ignore the invitation if you're not interested :-)

If you want to help out the community in other ways, you can:

  • give your opinion on other Github Issues & PRs;
  • chat with others in the Gitter Chatroom (usually for quick help: How do I do X);
  • answer Backpack questions on Stackoverflow; you get points, people get help; you can subscribe to the backpack-for-laravel tag by adding a new filter; that will send you emails when new questions come up with our tag;

Again. Thank you for the PR. You are a wonderful person. Keep 'em coming :-)
Cheers!

--
Justin Case
The Backpack Robot

P.S. Help in the Backpack community is rewarded with free Backpack commercial licenses. It's the least we can do. If you feel you've helped the community with PRs, help & other stuff, please apply for free licenses and mention this PR. You scratch my back, I scratch your back. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants