messageSource()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
dl 0
loc 6
rs 10
1
package com.github.netkorp.telegram.framework.configuration;
0 ignored issues
show
Code Smell introduced by
It is a best practice to supply a copyright/licence header in your code. Your organisation probably has a template for that.
Loading history...
2
3
import org.springframework.context.MessageSource;
4
import org.springframework.context.annotation.Bean;
5
import org.springframework.context.annotation.Configuration;
6
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
7
8
/**
9
 * Contains the configuration of locale for the bot.
10
 */
11
@Configuration
12
public class LocaleConfiguration {
0 ignored issues
show
Coding Style introduced by
Move this left curly brace to the beginning of next line of code.
Loading history...
13
14
    /**
15
     * Returns a custom {@link MessageSource} for resolving the Telegram Framework messages.
16
     *
17
     * @return the custom {@link MessageSource} instance.
18
     */
19
    @Bean("TelegramFrameworkMessageSource")
20
    public MessageSource messageSource() {
0 ignored issues
show
Coding Style introduced by
Make this line start at column 3.
Loading history...
Coding Style introduced by
Move this left curly brace to the beginning of next line of code.
Loading history...
21
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
0 ignored issues
show
Coding Style introduced by
Make this line start at column 5.
Loading history...
22
        messageSource.setBasenames("classpath:default/messages", "classpath:messages/messages");
23
        messageSource.setDefaultEncoding("UTF-8");
24
        return messageSource;
25
    }
26
}
27