Well, I searched everywhere in the docs, even on this page. But as far as I can see, this won’t work with variables, because of the output of the error. Do you have an example how i can hook into the output of the error message with those variables?
try {
$page->create('projects/project-d', 'project', array(
'title' => 'A page title',
'date' => '2016-02-21',
'text' => 'Lorem ipsum dolor set amet ...'
));
} catch(Exception $e) {
echo $e->getMessage();
}
But I’m getting an error, because the page “project-d” already exists. So the $e->getMessage() outputs “The page UID exists”. But I need it in german language. So how can I translate “The page UID exists”?
$page->create('projects/project-d', 'project', array(
'title' => 'A page title',
'date' => '2016-02-21',
'text' => 'Lorem ipsum dolor set amet ...'
));
} catch(Exception $e) {
l($e->getMessage());
}
```
And then define your variables in the language files:
```
l::set('The page UID exists', 'Die Seiten-UID existiert bereits');
```
You would have to find out what sort of error messages exist and could possibly be thrown. Maybe use an if statement to provide a fallback if there is a message you haven't covered.