Skip to content

feat: introduce a new @asgardeo/i18n module #178

@brionmario

Description

@brionmario

Current Limitation

The Asgardeo JavaScript SDKs currently have all i18n (internationalization) functionality centralized within the @asgardeo/javascript package. While this provides a central location, it creates several limitations:

  1. Tight Coupling: All packages that need i18n functionality must depend on the entire @asgardeo/javascript package, even if they only need translations
  2. Bundle Size: Packages importing i18n features also pull in the entire JavaScript SDK, increasing bundle size unnecessarily
  3. Circular Dependencies: Risk of circular dependency issues when other packages need to provide i18n support back to the JavaScript package
  4. Separation of Concerns: I18n functionality is mixed with core authentication logic, making it harder to maintain and extend
  5. Reusability: Other framework-specific packages cannot easily reuse i18n functionality without importing the full JavaScript SDK

Suggested Improvement

Extract the internationalization functionality from the @asgardeo/javascript package into a dedicated @asgardeo/i18n package that can be independently consumed by all Asgardeo JavaScript SDKs. This improvement includes:

  1. Standalone I18n Package: Create a new @asgardeo/i18n package containing:

    • Core i18n models and types (I18nBundle, I18nTranslations, I18nMetadata)
    • Default translation bundles (starting with en-US)
    • Utility functions for i18n management (getI18nBundles)
  2. JavaScript Package Cleanup: Refactor @asgardeo/javascript to:

    • Remove i18n models, translations, and utilities
    • Import i18n functionality from the new dedicated package
    • Maintain backward compatibility for existing I18nPreferences exports
  3. Enhanced Architecture:

    • Cleaner separation of concerns between authentication and i18n
    • Reduced bundle size for packages that only need i18n functionality
    • Better modularity and maintainability
    • Easier testing and development of i18n features in isolation
  4. Framework Integration: Update React and other framework-specific packages to directly consume the @asgardeo/i18n package while maintaining their specific context providers and hooks.

Please select the package issue is related to

@asgardeo/express

Version

current

Reporter Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided all the necessary information.
  • I have verified the improvement is not available in the latest version of the package.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions