8.4.1 How to translate Dashboard single page during installation?

Permalink
I add single pages programmatically in the Dashboard:
SinglePage::add('/dashboard/cars/', $pkg);
SinglePage::add('/dashboard/cars/options/', $pkg);

that will automatically add pages
- Dashboard -> Cars
- Dashboard -> Cars -> Options

But how can I have these page names translated in the package? Is there an option to save the page name as another name without breaking the functionality, because all controllers are working based on the URLs.

linuxoid
 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Have a look at any recent marketplace package that installs single pages. They all do a variation of:

$page  = SinglePage::add($path, $pkg);
$page->update(
   [
      'cName' => t(), 
      'cDescription' => t()
   ]
);
linuxoid replied on at Permalink Reply
linuxoid
Yes, of course, how could I forget that?

Thank you!!!

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.