Skip to content

v0.3.0#14

Merged
basemosama merged 10 commits into
mainfrom
qa
Jul 1, 2025
Merged

v0.3.0#14
basemosama merged 10 commits into
mainfrom
qa

Conversation

@basemosama

@basemosama basemosama commented Jul 1, 2025

Copy link
Copy Markdown
Member

0.3.0

Enhancemnts

  • Improved Delegate Configuration:

    • Added extraDelegates to inject custom localization delegates.
    • Added customLocalizationDelegateBuilder to fully customize the delegate list.
  • Logging Enhancements:

    • Added logLocaleChanges toggle in PlayxLocaleConfig.
    • Improved logs to show locale name, value, and index.
  • Removed easy_localization dependency; replaced with a custom, flexible system.

New Extensions

BuildContext Locale Helpers

  • Easily access locale info like currentLocale, localeTag, languageCode, isRtl, fontFamily, and more.

Number Extensions

  • Enhanced currency formatting with toFormattedCurrencyNumber and toLocalizedCurrencyNumber.
  • Added format options to all localized number methods.
  • New isZero utility for floating-point comparisons.

String Localization Extensions

  • Check for RTL/LTR, Arabic/English text, numbers, and diacritics.
  • Convert digits between Arabic and Western formats.
  • Normalize Arabic letters and clean up extra spaces.

Locale Utilities

  • New extensions for Locale, XLocale, and String for parsing and formatting.

basemosama added 10 commits July 1, 2025 11:25
…ctions - 86c47h79a

This commit introduces several enhancements to the `NumExtensions` class:

-   **Improved Currency Formatting:**
    -   `toFormattedCurrencyNumber`: Now accepts an optional `currencySymbol` and defaults to `"#,##0.00##"` format.
    -   `toLocalizedCurrencyNumber`: New function to format currency based on the current `PlayxLocalization` locale. Defaults to `ar_EG` for Arabic locales.
-   **Flexible Number Formatting:**
    -   `toFormattedNumber`: Retains its functionality for custom pattern and locale-based formatting.
    -   `toLocalizedArabicNumber` and `toLocalizedEnglishNumber`: Now accept an optional `format` parameter.
    -   `toLocalizedArabicOrEnglishNumber`: Now accepts an optional `format` parameter and uses the respective localized formatting functions.
    -   `toLocalizedNumber`: Now accepts an optional `format` parameter.
-   **New Utility Function:**
    -   `isZero`: New extension function to check if a number is approximately zero, considering floating-point precision.
This commit introduces a set of extensions for the `String` class, enhancing its capabilities for localization and language-specific analysis. These extensions include:

- Checking for RTL/LTR text direction.
- Identifying English and Arabic text.
- Checking if a string contains only English or only Arabic characters.
- Detecting the presence of numbers.
- Stripping Arabic diacritics (tashkeel).
- Converting between European and Arabic-Indic digits.
- Converting digits to localized format based on the current locale.
- Normalizing Arabic letters (e.g., Alef forms).
- Removing extra spaces from a string.
This commit introduces new extension methods on `BuildContext` to provide easy access to locale-related information.

The following methods have been added:
- `currentXLocale`: Returns the current `XLocale` object.
- `currentLocale`: Returns the current `Locale`.
- `localeTag`: Returns the current locale as a BCP-47 language tag.
- `currentLanguageCode`: Returns the current locale's language code.
- `fontFamily`: Returns the font family for the current locale.
- `isCurrentLocaleArabic`: Checks if the current locale is Arabic.
- `isCurrentLocaleEnglish`: Checks if the current locale is English.
- `isRtl`: Checks if the current locale is Right-To-Left.
- `isLtr`: Checks if the current locale is Left-To-Right.
This commit introduces two new options to `PlayxLocaleConfig`:

- `extraDelegates`: Allows adding custom `LocalizationsDelegate`s from other packages or sources.
- `customLocalizationDelegateBuilder`: Provides a function to build a completely custom list of delegates, potentially replacing or modifying the default ones.

These additions offer more flexibility in configuring the localization delegates used by the application.
This commit introduces several improvements and new features to the localization functionality:

- Added `logLocaleChanges` option to `PlayxLocaleConfig` to enable/disable logging of locale changes.
- Added `AssetLoader` abstract class and `RootBundleAssetLoader` implementation for loading translation files. This allows for custom asset loading strategies.
- Removed dependency on `easy_localization` package and integrated its core logic directly.
- Added `LocaleExtension` with `supports` and `toStringWithSeparator` methods.
- Added `XLocaleExtension` with `locale` getter and `toStringWithSeparator` method.
- Added `toLocale` extension method to `String` for converting a string to a `Locale` object.
- Improved logging for locale changes and translation loading errors.
- Minor refactoring and code cleanup.
- Improved logging in `PlayxLocalizationController` to include locale name, string representation, and index.
- Wrapped the builder in `PlayxLocalizationBuilder` with `Localizations` widget to ensure proper localization context.
@basemosama basemosama merged commit 21f6e50 into main Jul 1, 2025
1 check failed
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.

1 participant