public function translate(IdentifiableInterface $subject, $form = 'default', $preposition = true)
{
if (!method_exists($this, 'inflict' . ucfirst($form))) {
throw new MisconfigurationException('Language ' . $this->code . ' doesn\'t inflict to ' . $form);
}
$meta = $this->fromDictionary($subject);
$result = $this->extract($meta, $subject->expectsLongNames(), $form, true);
if ($result && $preposition) {
return $result;
}
if ($result && !$preposition) {
return mb_substr($result, mb_strpos($result, ' '));
}
$result = $this->inflictDefault($meta, $subject->expectsLongNames());
if ($form == 'default') {
return $result;
}
$result = $this->{'inflict' . ucfirst($form)}($result);
if ($preposition) {
$result = $this->getPreposition($form, $result) . ' ' . $result;
}
return $result;
}