Skip to content

Migrate from @phensley/language-tag to Intl.Locale for Fedify 2.0 #280

@dahlia

Description

@dahlia

Problem

Currently, Fedify uses the third-party @phensley/language-tag package and its LanguageTag class to represent language tags and locales. For Fedify 2.0, we should migrate to the standardized Intl.Locale class which is part of the web platform and provides better compatibility across different JavaScript environments.

Benefits

  • Standard API: Intl.Locale is a web standard, ensuring better long-term compatibility
  • Reduced dependencies: Eliminates the need for the @phensley/language-tag third-party package
  • Better platform support: Native support across Deno, Node.js, and Bun environments
  • Performance: Native implementation is likely more performant than userland code

Tasks

  • Audit current usage of @phensley/language-tag and LanguageTag throughout the codebase
  • Replace LanguageTag with Intl.Locale in all relevant code
  • Update type definitions and interfaces that reference LanguageTag
  • Update tests to use Intl.Locale instead of LanguageTag
  • Remove @phensley/language-tag dependency from package.json
  • Update documentation and examples to reflect the new API
  • Verify compatibility across all supported environments (Deno, Node.js, Bun)

Breaking Changes

This will be a breaking change for Fedify 2.0 as any public APIs that currently accept or return LanguageTag will now use Intl.Locale instead.

Migration Guide

Users will need to:

  • Replace LanguageTag imports with Intl.Locale
  • Update any code that creates or manipulates language tags to use the Intl.Locale constructor and methods
  • Review any custom code that depends on LanguageTag-specific methods or properties

Target

This should be completed as part of the Fedify 2.0 release.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions