Skip to content

Commit

Permalink
OLMIS-2611: moved getting locale to properties file
Browse files Browse the repository at this point in the history
  • Loading branch information
mkwiatkowskisoldevelo committed Jun 12, 2017
1 parent 80a7c4c commit 623d574
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions src/main/java/org/openlmis/template/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@

import java.util.Locale;

import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.LocaleUtils.toLocale;

@SpringBootApplication
@ImportResource("applicationContext.xml")
@EntityScan(basePackageClasses = BaseEntity.class, basePackages = "org.openlmis.util.converter")
Expand All @@ -58,7 +55,7 @@ public class Application {
private Logger logger = LoggerFactory.getLogger(Application.class);

@Value("${defaultLocale}")
private Locale defaultLocale;
private Locale locale;

@Autowired
DialectName dialectName;
Expand All @@ -83,12 +80,7 @@ public static void main(String[] args) {
public LocaleResolver localeResolver() {
CookieLocaleResolver lr = new CookieLocaleResolver();
lr.setCookieName("lang");

String envLocale = System.getenv("LOCALE");
Locale systemLocale = isBlank(envLocale)
? defaultLocale : toLocale(envLocale);
lr.setDefaultLocale(systemLocale);

lr.setDefaultLocale(locale);
return lr;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.default_schema=template
spring.jpa.show-sql=true

defaultLocale=en
defaultLocale=${LOCALE:en}

service.url=

0 comments on commit 623d574

Please sign in to comment.