jtwig-spring-translate-extension

Jtwig jtwig-spring-translate-extension

License

License

GroupId

GroupId

org.jtwig
ArtifactId

ArtifactId

jtwig-spring-translate-extension
Last Version

Last Version

5.86.1.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

jtwig-spring-translate-extension
Jtwig jtwig-spring-translate-extension
Project URL

Project URL

http://jtwig.org
Source Code Management

Source Code Management

https://github.com/jtwig/jtwig-spring-translate-extension

Download jtwig-spring-translate-extension

How to add to project

<!-- https://jarcasting.com/artifacts/org.jtwig/jtwig-spring-translate-extension/ -->
<dependency>
    <groupId>org.jtwig</groupId>
    <artifactId>jtwig-spring-translate-extension</artifactId>
    <version>5.86.1.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/org.jtwig/jtwig-spring-translate-extension/
implementation 'org.jtwig:jtwig-spring-translate-extension:5.86.1.RELEASE'
// https://jarcasting.com/artifacts/org.jtwig/jtwig-spring-translate-extension/
implementation ("org.jtwig:jtwig-spring-translate-extension:5.86.1.RELEASE")
'org.jtwig:jtwig-spring-translate-extension:jar:5.86.1.RELEASE'
<dependency org="org.jtwig" name="jtwig-spring-translate-extension" rev="5.86.1.RELEASE">
  <artifact name="jtwig-spring-translate-extension" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jtwig', module='jtwig-spring-translate-extension', version='5.86.1.RELEASE')
)
libraryDependencies += "org.jtwig" % "jtwig-spring-translate-extension" % "5.86.1.RELEASE"
[org.jtwig/jtwig-spring-translate-extension "5.86.1.RELEASE"]

Dependencies

compile (4)

Group / Artifact Type Version
org.jtwig : jtwig-spring jar 5.86.1.RELEASE
org.jtwig : jtwig-translate-extension jar 5.86.1.RELEASE
com.google.guava : guava jar 18.0
org.apache.commons : commons-lang3 jar 3.1

Project Modules

There are no modules declared in this project.

Jtwig Translate Extension

Build Stats

Build Status codecov Download

How to use?

With spring boot.

import org.jtwig.environment.EnvironmentConfigurationBuilder;
import org.jtwig.spring.JtwigViewResolver;
import org.jtwig.spring.boot.config.JtwigViewResolverConfigurer;
import org.jtwig.translate.spring.SpringTranslateExtension;
import org.jtwig.translate.spring.SpringTranslateExtensionConfiguration;
import org.jtwig.web.servlet.JtwigRenderer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;

@Configuration
public class JtwigMvcConfiguration implements JtwigViewResolverConfigurer {
    @Autowired
    private MessageSource messageSource;
    @Autowired
    private LocaleResolver localeResolver;

    @Override
    public void configure(JtwigViewResolver viewResolver) {
        viewResolver.setRenderer(new JtwigRenderer(EnvironmentConfigurationBuilder.configuration()
                .extensions().add(new SpringTranslateExtension(SpringTranslateExtensionConfiguration
                        .builder(messageSource)
                        .withLocaleResolver(localeResolver)
                        .build())).and()
                .build()));
    }
}

Licensing

Apache License

Requirements

  • Java 7
org.jtwig

Jtwig

Modern Java Template Engine

Versions

Version
5.86.1.RELEASE