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

thumbnail different from actual image in gridview
What is a recommended approach to communicate with Activity from Fragment? [duplicate]
How to group by only by date wise in JPA criteria query if column is DateTime or Timestamp
Clean and build all not working properly in eclipse
Empty ObjectFactory constructor is critical issue in Sonar
Hibernate EntityManager.remove(entity) deletes record from database and association but not from entity collection
Hibernate - Is it possible to map part of the table as a collection?
Some questions from a .NET developer about running Java programs in Eclipse [closed]
Java Bitset - What is the complete meaning of “Not Thread-Safe”
Java - how do I delete a non-empty buckets in google cloud?
ListView with Load More Button and Circle ProgressBar
Android VideoView play not from right position
Android Studio : Unsupported major.minor version 52.0
getting 403 forbidden error , from oauth2.0 using spring security
How to retrieve the data type of a unknown data type input by user in Object class, but it taking it as a string by default?
Performance testing for JAVA Backend and Cassandra for IOT Project

Categories

HOME
winforms
gremlin
spagobi
setup-deployment
programming-languages
cross-browser
ezpublish
opengl-es-2.0
fancybox
upload
autotools
python-unittest
here-api
fancybox-3
qt-creator
google-apps-marketplace
visual-studio-cordova
highlight.js
introduction
amazonsellercentral
riot.js
zurb-foundation-6
wijmo
info.plist
traffic
publish
c++-amp
procdump
microsoft-chart-controls
react-chartjs
galsim
airconsole
gammu
overlap
occlusion
awt
sfdc
dynamic-reports
texmaker
powershell-dsc
youcompleteme
pango
jquery-nestable
pnotify
celery-task
powercli
integrity
jxcore
diagnostics
namecoin
knpmenubundle
time-and-attendance
jquery-filter
mikroc
bstr
moveit
ready-api
packagist
php-parse-error
tform
rtbkit
prerequisites
msys
coveralls
rgeo
sframe
riak-cs
umbraco6
javax.mail
kineticjs
geonetwork
nsmutabledictionary
socketexception
xojo
elliptic-curve
xceed-datagrid
braille
rtmfp
mbr
flexmojos
cdc
gridfs
apc
web2py-modules
opcache
buster.js
gridcontrol
android-screen-support
robotics-studio
free-variable
dsn
newtonscript
spring-portlet-mvc
assembly-loading
bigcouch
gcj
psi
yslow
icanhaz.js
ext3
ncqrs
database-management
memory-size
procedural-music
misv

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