Skip to content

Releases: mantoufan/yzhanTranslator

Release Notes - Version 2.1.0

05 Oct 17:16
Compare
Choose a tag to compare

New Features

  • Images Descriptions: Introduced support for translating images by providing an array of image URLs. The translator now returns descriptions for each image in the specified language, enhancing the library's capabilities for handling visual content.

    • Example:
      $images = [
          'https://example.com/image1.jpg',
          'https://example.com/image2.jpg',
      ];
      $result = $translator->translate(json_encode($images), 'zh-CN', ['type' => 'images']);

Improvements

  • Updated the test suite to include cases for image translation, ensuring robust functionality and reliability.

Bug Fixes

  • Minor bug fixes and performance improvements for better stability.

Documentation

  • Updated the README to reflect the new image translation features and provide clear examples for users.

Release Notes - Version 2.0.2

05 Oct 09:50
Compare
Choose a tag to compare

YZhanTranslator Release Notes

Version 2.0.2

We're excited to announce the release of YZhanTranslator version 2.0.2! This update brings new features and improvements to enhance your translation and language detection capabilities.

New Features

  1. Language JSON Detection:

    • Added support for detecting the language of JSON content.
    • Use the same detect() method with JSON input for seamless integration.
  2. Enhanced Parameter Customization:

    • Introduced more flexible configuration options for fine-tuning translations and caching.

Improvements

  1. Expanded Documentation:

    • Updated README with comprehensive parameter descriptions.
    • Added examples for all major features, including the new JSON language detection.
  2. Caching Enhancements:

    • Improved caching options for better performance and cost savings.
    • Added maxAge parameter for controlling cache expiration.
  3. Timeout Control:

    • Introduced timeout parameter for better control over API requests.

Detailed Changes

  • Added detect() method support for JSON input.
  • Expanded $params array options in translate() and detect() methods:
    • prompt: For custom translation instructions.
    • cache.type: Specify caching mechanism (default: 'File').
    • cache.params: Configure cache-specific options.
    • cache.params.dir: Set custom directory for file-based caching.
    • cache.maxAge: Control cache expiration time.
    • timeout: Set custom request timeout (default: 6 seconds).

Upgrading

This release is fully backwards-compatible. To take advantage of the new features:

  1. Update YZhanTranslator in your project:
    composer update mantoufan/yzhantranslator
    
  2. Refer to the updated README for new usage examples and parameter options.

Feedback

We value your input! If you encounter any issues or have suggestions for future improvements, please open an issue on our GitHub repository.

Thank you for using YZhanTranslator!

Release Notes - Version 1.1.0

04 Oct 08:58
Compare
Choose a tag to compare

Feature

  • 🆕 Additional prompts can be used to customize the results, such as not translating the href attribute
  • 🔧 Using gpt-4o-mini instead of gpt-4o, could use model to customize
  • 🐛 Automatically clear cache when translation results cannot be obtained

1.0.0

03 Oct 16:39
Compare
Choose a tag to compare

Release Notes - Version 1.0.0

YZhanJSONTranslater

Release Date: October 4, 2024


New Features

  1. JSON Translation with OpenAI:

    • Translates the values of a JSON object to different languages while keeping the keys unchanged.
    • Supports multiple languages using OpenAI's GPT-4 models.
  2. Customizable API Client Configuration:

    • Ability to configure OpenAI client settings, including API key, organization ID, and API URL.
  3. Caching Mechanism:

    • File-based caching: Reduce API calls and costs by caching translated results.
    • Cache customization:
      • Cache type: Currently supports File-based caching.
      • Cache parameters: Specify cache directory using the params['dir'] field.
      • Cache expiration: Set cache expiration time in seconds using the maxAge field to control how long cache is valid.
  4. Environment Variables Support:

    • Configure OpenAI credentials through environment variables (OPENAI_APIKEY, OPENAI_APIURL, OPENAI_ORGANIZATION).

Enhancements

  • Improved API request efficiency by utilizing caching mechanisms.
  • Enhanced translation accuracy and flexibility with OpenAI GPT-4 integration.
  • Detailed cache control options for optimized API usage and response time.

Testing & Developer Tools

  • PHPUnit Integration:

    • Unit tests for translation functionality.
    • Cache-related test cases to ensure cache behavior works as expected.
  • Composer Scripts:

    • test: Run unit tests using phpunit.
    • coverage: Generate test coverage reports.

Requirements

  • PHP 5.4 or above.
  • OpenAI API key and organization ID.
  • Composer for managing dependencies.

Documentation

  • Detailed usage instructions, including examples for translating JSON and configuring cache settings.
  • Unit tests for translation and cache handling.

Known Issues

  • Only File-based caching is supported in this release; additional cache types may be added in future releases.