Skip to content

Translating $eventName (localization) #1021

Answered by seche
AskinSavascisi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

is it possible to translate the $eventName variable to active localization version?

public function getActivitylogOptions() { return LogOptions::defaults() ->setDescriptionForEvent(fn(string $eventName) => __('lang.has_been')."{$eventName}"); }

Just use __($eventName) and include the translation key in your translation files.

public function getActivitylogOptions()
{
return LogOptions::defaults()
->setDescriptionForEvent(fn(string $eventName) => __('lang.has_been') . __($eventName));
}

By default, the package provides the following keys: created, updated, deleted.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AskinSavascisi
Comment options

Answer selected by AskinSavascisi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants