Is there any java design template for developing this script.
I do not know if there is a template.
If I understand your question correctly, I can explain what I usually do .
- Insert localized strings into the values โโof my properties
I usually use #number# - Replace it later when resolving variables
A small example:
messages.properties
name.of.key = sum of
Then I read the value and replaced #num# with the appropriate values โโ( NOTE: this uses the same method for abbreviations, but I use the external replace method):
public void printSum(int n1, int n2) { String myString = messageSource("name.of.key", Locale.getDefault(), null, null)); myString.replace("#0#", String.valueOf(n1)); myString.replace("#1#", String.valueOf(n2)); myString.replace("#2#", String.valueOf(n1+n2)); System.out.println(myString); }
EXIT printSum(1,2);
sum of 1 + 2 = 3
source share