Humanizer is a .NET library that provides a comprehensive set of extension methods for converting raw data types (numbers, dates, times, byte sizes, strings, enums, collections) into human-readable, localized text. It supports over 90 locales with full pluralization, ordinalization, inflection, and parsing of number words back to numeric values. The library is designed as a reusable dependency for applications requiring user-friendly formatting. Architecturally, Humanizer follows a strategy/registry pattern: each formatting domain (number-to-words, date humanization, ordinalization, etc.) defines an interface and a default implementation, with locale-specific overrides resolved through a central Configurator. Locale data is defined in YAML files and compiled at build time by a Roslyn source generator into immutable profile classes, keeping runtime algorithms generic and data-driven. The library also includes Roslyn analyzers for API migration and a comprehensive test suite with cross-locale theory tests. Key entry points are extension methods on primitive types (e.g., `42.ToWords()`, `"hello_world".Humanize()`, `DateTime.Now.Humanize()`, `ByteSize.FromBytes(1024).Humanize()`) and the `Configurator` for advanced configuration. The primary data flow is: user calls an extension method β culture resolution β delegation to the appropriate converter/formatter β use of generated profile data to produce localized output. External dependencies are limited to the .NET standard library and CLDR plural rule data.
Day.js is a lightweight JavaScript date/time library (approximately 2 kB gzipped) designed as a drop-in alternative to Moment.js. It provides immutable, chainable parsing, validation, manipulation, formatting, and comparison APIs, along with extensive internationalization support via over 100 locale files. The library is built as a modular core with a plugin system that extends functionality without bloating the base bundle. It runs in both browsers and Node.js, includes TypeScript definitions, and has a comprehensive test suite that ensures behavioral parity with Moment.js. This is a library, not an application or data pipelineβthere are no server components, CLI tools, or data analysis artifacts. The architecture is intentionally small and focused, with a constant-driven unit system and a clean separation between core, plugins, and locales.
This repository is a Laravel package that extends the framework's localization capabilities to include country-specific formatting. It provides a middleware that automatically detects the user's preferred language and country from browser headers or user profile, sets session variables, and offers a facade with methods to retrieve localized date formats, currency symbols, country names, and emoji flags. It also includes a language switcher controller and listens to login events to persist user preferences. The architecture follows Laravel's service provider pattern, with a main LangCountry class that reads data from bundled JSON files for each supported locale. The package integrates with Carbon for date formatting and provides Carbon macros for convenient use. The codebase is well-tested with 100% coverage, typed, and follows PSR-12 coding standards. The most reusable component is the PreferredLanguage service, which encapsulates the logic of parsing the Accept-Language header and matching against allowed locales with quality weighting and fallback. This could be extracted into a standalone library for browser language detection in any PHP project.