v0.3.0#14
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0.3.0
Enhancemnts
Improved Delegate Configuration:
extraDelegatesto inject custom localization delegates.customLocalizationDelegateBuilderto fully customize the delegate list.Logging Enhancements:
logLocaleChangestoggle inPlayxLocaleConfig.Removed
easy_localizationdependency; replaced with a custom, flexible system.New Extensions
BuildContextLocale HelperscurrentLocale,localeTag,languageCode,isRtl,fontFamily, and more.Number Extensions
toFormattedCurrencyNumberandtoLocalizedCurrencyNumber.isZeroutility for floating-point comparisons.String Localization Extensions
Locale Utilities
Locale,XLocale, andStringfor parsing and formatting.