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

Intellij does not build JavaFX with libraries
Possible to Delete Directory/File Too Soon?
What is the appropriate way to deliver a notification intent to an Android activity if it is in the foreground and otherwise start it?
bootstrap 3, the button does not work on IE (java) (.jsp)
Only binary format input
Android going back to old activity
JOGL error with glVertexAttribPointer
Spring - Accessing parameters of annotation in Advice
how to get response from servlet for ajax call
What kind of strategy is more efficient: create a new socket or use one already created?
Reading from an InputStream without blocking [duplicate]
OutOfMemoryError while importing JasperPrint from file
Draw a bitmap from URL based on a true/false condition
Executing code at forced system exit [duplicate]
display certificate content from db
Correct Approach for Testing class having no default contructor?

Categories

HOME
compiler-construction
amazon-ec2
plot
layout
syntax
octobercms
gis
rsync
leon
twitter-bootstrap-4
echarts
opengl-es-2.0
networkx
azure-storage-tables
facebook-php-sdk
leiningen
windows-server-2012
clearcase-ucm
ef-migrations
footer
alpine
jquery-ajaxq
facebook-instant-articles
realex-payments-api
dynamic-featured-image
filezilla
neo4j-spatial
bcd
yadcf
phpfreechat
xmlreader
mpmediaquery
hot-module-replacement
code-search-engine
sqlite2
awt
ws-security
unoconv
galen
reportingservices-2005
nxlog
keydown
midl
outlook-api
acoustics
wso2carbon
scrollable
appcompat
pebble-watch
tropo
media-player
windows-mobile-6.5
nbconvert
spring-mongodb
yt-project
angular-strap
spring-android
angular-cache
rotativa
file-writing
player
bgp
suffix-tree
ios8-today-widget
sdhc
cyclomatic-complexity
mutation-observers
tmuxinator
drawbitmap
graph-drawing
sailfish-os
sonarqube5.1.2
graph-api-explorer
umbraco6
nstableviewcell
file-copying
zend-route
openexr
valueconverter
bundles
jmapviewer
blending
jplaton
wsdl-2.0
kyotocabinet
gil
onsubmit
ticoredatasync
dotnethighcharts
ohm
assembly-loading
xdomainrequest
krl
site.master
asp.net-mvc-areas
mozilla-prism
routedevent
vc90
microsoft-virtualization
eqatec
w3wp
geneva-server

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