Skip to content

Comments

Add support for 3-2-2 comma rule (Indian number grouping)#3

Draft
Claude wants to merge 3 commits intomasterfrom
claude/add-3-2-2-comma-rule
Draft

Add support for 3-2-2 comma rule (Indian number grouping)#3
Claude wants to merge 3 commits intomasterfrom
claude/add-3-2-2-comma-rule

Conversation

@Claude
Copy link

@Claude Claude AI commented Feb 14, 2026

Status

PENDING REVIEW

What does this PR accomplish?

  • Adds support for Indian numbering system (3-2-2 comma rule) where numbers are formatted as 1,00,00,000 instead of Western 10,000,000
  • Implements instance-wide configuration for number grouping style
  • Provides environment variable configuration support via MB_CUSTOM_FORMATTING

How to test this manually?

Option 1: UI Configuration

  1. Start the application and navigate to Admin → Settings → Localization
  2. Under the Numbers section, select Grouping style
  3. Choose "1,00,00,000 (Indian)" and verify numbers throughout the application display with 3-2-2 grouping
  4. Test with various number types:
    • Large numbers: 10,000,000 → 1,00,00,000
    • Currency: $10,000,000.00 → $1,00,00,000.00
    • Negative: -1,000,000 → -10,00,000
  5. Combine with different separator styles (period, space, apostrophe)
  6. Verify Western grouping (10,000,000) remains default

Option 2: Environment Variable Configuration

  1. Set the MB_CUSTOM_FORMATTING environment variable:
    MB_CUSTOM_FORMATTING='{"type/Number":{"number_separators":".,","number_grouping":"indian"}}'
  2. Start the application and verify Indian grouping is applied throughout
  3. Test with different separator combinations:
    # Indian grouping with European separators
    MB_CUSTOM_FORMATTING='{"type/Number":{"number_separators":",.","number_grouping":"indian"}}'

Additional notes:

Implementation approach:
Uses native locale support (en-IN for Indian, en for Western) rather than custom grouping logic, ensuring standards compliance and maintainability.

Changes made:

  • Frontend types: Added number_grouping field to NumberFormattingSettings
  • Number formatter: Modified to use en-IN locale when number_grouping is "indian"
  • Settings UI: Added radio controls for grouping style selection (defaults to "western")
  • Backend validation: Added available-number-groupings set and validation
  • JVM backend: Updated active-locale to return Indian locale for 3-2-2 grouping
  • ClojureScript backend: Updated formatter to use Indian locale
  • Tests: Added comprehensive test suite covering all grouping scenarios

Environment variable support:
The number_grouping setting is stored within the existing custom-formatting JSON structure, making it automatically configurable via the MB_CUSTOM_FORMATTING environment variable. This allows instance-wide configuration in containerized deployments without requiring UI access.

Backward compatibility:
Default behavior unchanged (Western grouping). New number_grouping field is optional.

Screenshots:

Settings UI showing the new grouping style option would be helpful here

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for 3-2-2 comma rule.</issue_title>
<issue_description>Currently Numbers are always displayed in 3-3 comma rule. Add support for adding 3-2-2 comma rule.

Also check if it's possible to configure an instance to use 3-2-2 comma rule</issue_description>

Comments on the Issue (you are @claude[agent] in this section)

Claude AI and others added 2 commits February 14, 2026 07:33
Co-authored-by: gigincg <13028584+gigincg@users.noreply.github.com>
Co-authored-by: gigincg <13028584+gigincg@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Add support for 3-2-2 comma rule configuration Add support for 3-2-2 comma rule (Indian number grouping) Feb 14, 2026
@Claude Claude AI requested a review from gigincg February 14, 2026 07:36
@gigincg
Copy link
Member

gigincg commented Feb 14, 2026

@claude[agent] Are you sure this ability is not available using an ENV

@Claude
Copy link
Author

Claude AI commented Feb 14, 2026

@claude[agent] Are you sure this ability is not available using an ENV

Yes, this feature is available via the MB_CUSTOM_FORMATTING environment variable. Since number_grouping is stored within the custom-formatting setting structure, you can configure it using:

MB_CUSTOM_FORMATTING='{"type/Number":{"number_separators":".,","number_grouping":"indian"}}'

This allows instance-wide configuration via ENV without requiring UI access. The setting validates the number_grouping value on the backend to ensure it's either "western" or "indian".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for 3-2-2 comma rule.

2 participants