From 14a248b76f0d4c4fa80d03de359f152e6bebae96 Mon Sep 17 00:00:00 2001 From: Daniel Nigusse Date: Sat, 14 Sep 2024 13:19:16 +0300 Subject: [PATCH] chore(release): v0.1.1 - Bump version to v0.1.1 for new release - Update CHANGELOG.md with latest changes - Add distribution files for publishing on PyPI - Ensure compatibility with the latest Django version --- CHANGELOG.md | 41 +++++++++++++++++++++++++++++++++++++++++ lisan/middleware.py | 1 - setup.py | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9f4ee1b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,41 @@ +## [v0.1.1] - 2024-09-14 + +This version brings enhanced flexibility, making the `lisan` package highly adaptable for multilingual projects by enabling external services for automated translations while maintaining a customizable architecture. + +### Added +- **Pluggable Translation Service**: Introduced a base `BaseTranslationService` class, allowing easy integration of third-party or custom translation services. + - Added an example implementation with `GoogleTranslateService` using Google’s translation API. + - Enabled dynamic loading of translation services via Django settings (`LISAN_DEFAULT_TRANSLATION_SERVICE`). + +- **Auto-Translation Support**: + - Added an `auto_translate` option to `get_lisan_field` in `LisanModelMixin`, enabling automatic translation fallback when specific language translations are missing. + - Added auto-translation support in serializers and admin displays for models with translatable fields. + +- **Bulk Translation Operations**: Added `set_bulk_lisans` method to support creating or updating translations for multiple languages in bulk. + +- **Flexible Field Types**: Enhanced support for additional field types, such as `TextField`, `JSONField`, and more, in translatable models. + +- **Customizable Admin Display**: + - Introduced `lisan_display_format` for customizing how translated fields appear in the Django admin interface. + +- **Middleware Improvement**: Enhanced `LanguageMiddleware` to support multiple language detection sources, including query parameters (`?lang=xx`), cookies, and user profile settings. + +### Fixed +- Improved fallback language handling for missing translations, with a new configuration (`LISAN_FALLBACK_LANGUAGES`) allowing developers to define custom fallback hierarchies. + +### Configuration Changes +- **New Settings**: + - `LISAN_DEFAULT_TRANSLATION_SERVICE`: Configure the default translation service dynamically. + - `LISAN_FALLBACK_LANGUAGES`: Customize fallback languages in case a specific translation is missing. + +--- + +### Migration Notes +No database migrations are required for this release, but additional configuration in `settings.py` may be necessary to leverage new features like auto-translation and pluggable services. + +--- + +### Future Plans +- Introduce caching for external translation service results to minimize API calls. +- Add support for other translation services such as DeepL and Microsoft Translator. +- Improve manual translation management in the Django admin interface. \ No newline at end of file diff --git a/lisan/middleware.py b/lisan/middleware.py index 301a1db..0b11fb4 100644 --- a/lisan/middleware.py +++ b/lisan/middleware.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.utils.deprecation import MiddlewareMixin diff --git a/setup.py b/setup.py index f069b0b..c8c501e 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def read_file(filename): setup( name='lisan', - version='0.1.0', + version='0.1.1', packages=find_packages(), include_package_data=True, license='MIT',