Skip to content

Add translation support #13

@daniel-werner

Description

@daniel-werner

Crete a twig function as a wrapper to Laravel translation function __()

Currently the following class can be used as a workaround:

class TwigTranslator
{
    public function __($key, $replace = [], $locale = null)
    {
        return app('translator')->getFromJson($key, $replace, $locale);
    }
}

        $twigTranlator = new TwigTranslator();
.
.
.
        $documentTemplate->addTemplateData($twigTranlator, 'trans')

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions