In the ETS tool, we can see 4 templates related to reset-pass (account-validator). But only the default one is loaded.
These templates are all translated in Chinese, which can be found in the template file. But these Chinese templates are not loaded.
In ValidationLogicImpl.java, the sentence below is invoked to check the existence of a template:
emailTemplateService.getEmailTemplate(key, new Locale(locale)) == null
The variable here is locale string (like es, zh_CN, etc.). But the wrong constructor of Locale is invoked. To a language_country locale, the constructor Locale(String language, String country) should be used.
And after some effort to solve this problem, I find some other issues shows up. Even the Locale object is correct, the function getEmailTemplate of EmailTemplateService will not return null. Since the logic of it will find the 'default' template. And the correct method is getEmailTemplateNoDefault which is 'private'.
So I just give up the effort and try to invoke the method processEmailTemplates in EmailTemplateService directly.
The modification of EmailTemplateService is finished in SAK-27876, and this patch will make reset-pass to use it to load templates.
1. Move all template files from account-validation-impl to account-validation-api to make EmailTemplateService to read them.
2. Modify the code in ValidationLogicImpl.java to invoke ETS function and remove the tool-specified code. This almost remove 100 line of code.