laravel-achievements
laravel-achievements copied to clipboard
Multilingual Support
class UserMadeComment extends Achievement
{
/*
* The achievement name
*/
public $name = trans('achievements.made-first-comment-name');
/*
* A small description for the achievement
*/
public $description = trans('achievements.made-first-comment-description');
}
results in
[2021-03-14 16:26:54] prod.ERROR: Constant expression contains invalid operations {"userId":4,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Constant expression contains invalid operations at /var/www/html/app/Achievements/UserMadeComment.php:23)
because trans won't work on constants
@assada Therefore I propose the usage of methods like getName()
and getDescription()
. I am going to open a PR for this (hopefully) today.
@Wulfheart It would be great!
@assada could you please assign me that issue so I don’t lose track?
If there is no active contribution, Can I take care of this issue? @assada
Sure. It is quite easy to implement. Haven’t had the time yet. Go for it!