I have all my ResourceBundle values in a table and formatted as per requirement. I have to change the languages on the website based on user selection in a drop
Or you could use
Locale us = Locale.forLanguageTag("en-US") and us.toLanguageTag(), and that will do the conversion for you without having to create your own error-prone implementation.