Skip to content

MX-236: Implement i18N for the messages sent by SMS or Email - #146

Merged
IOhacker merged 1 commit into
openMF:developfrom
IOhacker:develop
Apr 14, 2026
Merged

MX-236: Implement i18N for the messages sent by SMS or Email#146
IOhacker merged 1 commit into
openMF:developfrom
IOhacker:develop

Conversation

@IOhacker

@IOhacker IOhacker commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

MX-236: Implement i18N for the messages sent by SMS or Email

Summary by CodeRabbit

Release Notes

  • New Features
    • Added multi-language support (English and Spanish) for SMS and email authorization messages in the self-service registration flow
    • Email authorization notifications now use HTML templates for improved formatting and presentation

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: affe0015-1143-422a-ae58-5f8e4156c9f3

📥 Commits

Reviewing files that changed from the base of the PR and between be7c43a and bbd8d83.

📒 Files selected for processing (7)
  • pom.xml
  • src/main/java/org/apache/fineract/selfservice/registration/service/SelfServiceRegistrationWritePlatformServiceImpl.java
  • src/main/java/org/apache/fineract/selfservice/registration/starter/SelfRegistrationConfiguration.java
  • src/main/resources/i18n/messages.properties
  • src/main/resources/i18n/messages_es.properties
  • src/main/resources/mail-templates/authorization-email.html
  • src/test/java/org/apache/fineract/selfservice/registration/service/SelfServiceRegistrationWritePlatformServiceImplTest.java

📝 Walkthrough

Walkthrough

The changes introduce internationalization and email templating capabilities to the self-service registration flow. Hard-coded email subjects, bodies, and SMS messages are replaced with locale-aware message properties and Thymeleaf-rendered HTML templates. Configuration beans for MessageSource and SpringTemplateEngine are added alongside Maven dependency for Thymeleaf Spring 6 support.

Changes

Cohort / File(s) Summary
Maven Configuration
pom.xml
Added org.thymeleaf:thymeleaf-spring6 dependency under email template comment.
Spring Configuration
src/main/java/org/apache/fineract/selfservice/registration/starter/SelfRegistrationConfiguration.java
Added two new beans: registrationMessageSource() (ResourceBundleMessageSource with i18n/messages basename) and registrationTemplateEngine() (SpringTemplateEngine with ClassLoaderTemplateResolver for mail-templates). Updated service bean to inject both new dependencies.
Service Implementation
src/main/java/org/apache/fineract/selfservice/registration/service/SelfServiceRegistrationWritePlatformServiceImpl.java
Injected ITemplateEngine and MessageSource dependencies. Replaced hard-coded SMS messages with i18n lookup using current locale. Replaced hard-coded email subject and body with i18n lookup and Thymeleaf template rendering using firstName, requestId, and authToken variables.
Internationalization Resources
src/main/resources/i18n/messages.properties, src/main/resources/i18n/messages_es.properties
Created default and Spanish locale message property files containing keys for email subject, greeting, instructions, request ID label, authorization code label, regards signature, and SMS message template with parameterized placeholders.
Email Template
src/main/resources/mail-templates/authorization-email.html
Added new Thymeleaf HTML template for authorization emails with localized message keys and injection of runtime variables (firstName, requestId, authToken).
Unit Tests
src/test/java/org/apache/fineract/selfservice/registration/service/SelfServiceRegistrationWritePlatformServiceImplTest.java
Added mock dependencies for ITemplateEngine and MessageSource. Updated test setup to pass new mocked dependencies to service constructor.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Registration Flow
    participant Service as SelfServiceRegistrationWritePlatformServiceImpl
    participant MessageSource as MessageSource (i18n)
    participant TemplateEngine as Thymeleaf Engine
    participant Resources as Template/Resource Files

    Client->>Service: sendAuthorizationMessage()
    
    rect rgba(100, 150, 200, 0.5)
    Note over Service,MessageSource: SMS Authorization Flow
    Service->>MessageSource: getMessage("sms.message", variables, locale)
    MessageSource->>Resources: Look up locale-specific message
    Resources-->>MessageSource: Message template with {0}, {1}, {2}
    MessageSource-->>Service: Resolved SMS message
    end
    
    rect rgba(150, 100, 200, 0.5)
    Note over Service,TemplateEngine: Email Authorization Flow
    Service->>MessageSource: getMessage("email.subject", locale)
    MessageSource-->>Service: Email subject
    Service->>TemplateEngine: process("authorization-email", context)
    TemplateEngine->>Resources: Load authorization-email.html template
    TemplateEngine->>MessageSource: Resolve message keys (greeting, instructions, etc.)
    MessageSource-->>TemplateEngine: Localized text
    TemplateEngine->>TemplateEngine: Render with firstName, requestId, authToken
    TemplateEngine-->>Service: HTML email body
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

⏱️ <10 Min Review

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@IOhacker
IOhacker merged commit 5d631c4 into openMF:develop Apr 14, 2026
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant