-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first basic i18n support for webpage #70
Conversation
…asic i18n for now implements MessageSource to do so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good try. for the HTML files, we can just translate the HTML. there is a way to do resource translation. we do need message translation for the "bad password" message a little lower down in postOauthToken()
@@ -156,12 +161,20 @@ private CredentialAccount convertAccount2CredentialAccount(Account a) { | |||
|
|||
@GetMapping("/oauth/authorize") | |||
String getOauthAuthorize(@RequestParam String client_id, @RequestParam String redirect_uri, | |||
@RequestParam(required = false, defaultValue = "") String error) throws IOException { | |||
@RequestParam(required = false, defaultValue = "") String error, @RequestHeader("Accept" + | |||
"-Language") String acceptLanguage) throws IOException { | |||
try (var is = AppController.class.getResourceAsStream("/static/oauth/authorize.html")) { | |||
var authorizePage = new String(is.readAllBytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be using thyme here instead of getResourceAsStream
Locale userLocale = Locale.forLanguageTag(acceptLanguage); | ||
authorizePage = authorizePage.replace("authorize_error", | ||
messageSource.getMessage("authorizeError", null, userLocale)); | ||
authorizePage = authorizePage.replace("Email", messageSource.getMessage("email", null, userLocale)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing the replace() for authorize_error is sketchy but unlikely to collide with normal text. Email may appear in multiple places. that is why we need to use a thyme template
…e behind the scenes.
No description provided.