yoeunes / toastr

:eyes: toastr.js notifications for Laravel
https://php-flasher.io
MIT License
375 stars 52 forks source link

How to translate the messages #37

Closed DiegoMaiaSSA closed 1 year ago

DiegoMaiaSSA commented 1 year ago

Hi, i'd like to know how to translate the Success word from the toastr mensage.

image

I'm from Brazil and i need to translate it to portugueses.

Thanks!!!

yoeunes commented 1 year ago

Hi @DiegoMaiaSSA,

It appears there may be a bit of a mix-up. The image you shared seems to correspond to another library I maintain, PHPFlasher. Although yoeunes/toastr is based on PHPFlasher, the resulting notification you're seeing is from PHPFlasher, not yoeunes/toastr.

Therefore, for your issue concerning translation, you might want to visit the translation section of PHPFlasher: https://php-flasher.io/laravel/#-translation

Here's a brief snippet from the translation file:

<?php // /resources/lang/vendor/flasher/fr/messages.php

return [
    'success' => 'Succès',
    'error' => 'Erreur',
    'warning' => 'Avertissement',
    'info' => 'Information',
];

For Portuguese translation, you would simply replace the right-hand side of the array with your desired translations.

Let me know if you have any other questions or issues. I'm here to help!

Best regards, Younes

DiegoMaiaSSA commented 1 year ago

Thanks for helping man!

I never would have thought of that because I just used the "composer require yoeunes/toastr" command.

Maybe it's because I use admin LTE? I don't think so, because before demanding your package, I didn't receive this kind of message.

image

Edit: worked perfectly! Thanks a lot!

yoeunes commented 1 year ago

Hey @DiegoMaiaSSA 👋,

It's my pleasure to help! The PHPFlasher library is actually a dependency of yoeunes/toastr, which is why you saw that specific notification. It's the underlying engine that handles the notifications in yoeunes/toastr, so it's normal to see its effects even when you are directly interacting with yoeunes/toastr. It can be a bit confusing, but I'm glad you got everything sorted out!

If you have any further questions or issues, don't hesitate to reach out.