java


Change translation handling in Spring


Sorry if the code is not sufficient, I'm trying to figure out how to start implementing this.
Basic locale beans are set up in the WebMvcConfigurerAdapter
#Bean
public LocaleResolver localeResolver() {
SessionLocaleResolver resolver = new SessionLocaleResolver();
resolver.setDefaultLocale(new Locale("en"));
return resolver;
}
#Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
interceptor.setParamName("language");
registry.addInterceptor(interceptor);
}
The default functionality from this is to read translations from different [language].properties files, that I do know.
My question here is if I can change that within spring. So instead of reading translations through files I read them through my custom method/functionality.
I tried searching for a solution, but I didn't run into anything.
For example, say I have translations in some java class (purely out of example) and instead of reading files I want to read through that class, where the inner functionality would be something like:
return TranslationConstants.getMap(translationKey, locale);
The reason why I don't just use it like this everywhere is because I wouldn't like the code to be like this and so I can still use view renderers to nativelly print translations (ie. #{value} in thymeleaf)
Sorry if the question is confusing/misleading.
Pointers to other similar questions are also welcome, I just couldn't find anything.

Related Links

Can someone explain this Java syntax to me?
How to render a web page using the in-built android browser with the jdk?
Java performance problem for math.abs
How can I search a string in a very big file with a specific format in java? [duplicate]
Get objects' index in a Java List
Restlet GAE sample doesn't work with Google App Engine Toolkit 1.4.0
My programs print statement is wrong
Java cache design question
In OSGi, my Permission is denied in Main thread but allowed in EDT thread
Why does this not return the IP address?
Difference between ANYFORMAT and ANYFORMAT_RTP
Embeddable Container in Jboss 6.0.0.Final
Complete Novice Programmer: Novice Guide to Java Programming [closed]
Understanding JNDI
setting a string into long[] for vibrate function
JSF command button is not compile

Categories

HOME
cakephp
blogger
fluentd
drivers
pycharm
reserved
razor
microservices
win32gui
wamp
esper
add
slurm
elasticsearch-hadoop
facebook-php-sdk
spring-xd
floating-action-button
fortumo
hapi
clojurescript
opentracing
saxon
google-cloud-speech
one-hot-encoding
orleans
mustache.php
claims-based-identity
smb
vlsi
su
underflow
intel-pin
webkitspeechrecognition
flink-streaming
fog
vsts-build-task
asset-pipeline
language-concepts
vxworks
lto
tasker
ruby-on-rails-3.1
google-closure
android-mediaprojection
outlook-2013
atomicity
python-webbrowser
domain-model
colorama
google-perftools
knpmenubundle
mako
cudafy.net
lync-client-sdk
root-framework
cubes
spring-android
azure-sdk
contact-list
multiple-regression
disque
master-slave
nessus
netmq
qtableview
atk4
libressl
security-testing
tableau-online
ideamart
vstest.console.exe
sorl-thumbnail
dd
java-metro-framework
titanium-modules
typeof
xceed-datagrid
braille
hyprlinkr
terminal-services
ember-app-kit
dmoz
broken-links
joyent
tomcat-valve
locationlistener
appendto
mongomapper
floating
lang
remember-me
castle-monorail
perfect-hash
meego
ctp4
project-hosting
ubuntu-9.04
document-conversion

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App