argos_translator_offline 1.2.0 copy "argos_translator_offline: ^1.2.0" to clipboard
argos_translator_offline: ^1.2.0 copied to clipboard

A Flutter package to automated translate localization keys from .arb files. and .json file offline and free

Argos Translate Dart #

ko-fi

PRs Welcome Pub Version

A Flutter package for offline and free automated translation of localization keys from .arb and .json files.

Features #

  • Offline translation support
  • Free to use
  • Supports .arb and .json file formats
  • Automatic translation of localization keys
  • Cross-platform compatibility

Prerequisites #

  1. Install Python (3.7 or higher) - Recommended to use Python 3.11 which it's latest supported one for sentencepiece & argostranslate Download Python 3.11
  2. Install argos-translate using pip: Option(A)
pip install sentencepiece  
pip install argostranslate    

Also Can use UV for install package: Option(B)

uv pip install sentencepiece
uv pip install argostranslate

For more information about argos-translate, visit:

Installation #

Add this package to your pubspec.yaml under dev_dependencies:

dev_dependencies:
  argos_translator_offline: ^1.2.0

Then run:

flutter pub get

Usage #

Run the translation command with the following format:

dart run argos_translator_offline path=<path_to_your_file> from=<source_language> to=<target_language>

Example:

dart run argos_translator_offline path=test/lang/lang.arb from=en to=ar

This will translate your localization file from English to Arabic.

Requirements #

  • Dart SDK >= 3.0.0
  • Flutter SDK (latest version recommended)
  • Python 3.7 or higher - Recommended to use Python 3.11 which it's latest supported one for sentencepiece & argostranslate Download Python 3.11
  • argos-translate Python package

Project Structure #

├── bin/          # Command-line application entrypoint
├── lib/          # Library code
├── test/         # Unit tests
├── dlls/         # Dynamic link libraries
└── venv/         # Python virtual environment

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Author #

Support #

If you encounter any issues or have questions, please file an issue on the GitHub repository.

Dependencies #

This package uses the following dependencies:

  • ffi - For foreign function interface
  • path - For path manipulation

API Documentation #

The package provides the following public API members:

ArgosTranslate Class #

The main class that provides offline translation capabilities.

Methods

  • initialize(String libraryPath): Initializes the Argos Translate library with the specified DLL path.

    ArgosTranslate.initialize('path/to/argos_bridge.dll');
    
  • translate(String text, String fromCode, String toCode): Translates text from one language to another.

    String translated = ArgosTranslate.translate('Hello', 'en', 'ar');
    
  • installPackage(String fromCode, String toCode): Installs a language package for translation between two languages.

    await ArgosTranslate.installPackage('en', 'ar');
    

Documentation Requirements #

When contributing to this package, please ensure all public API members are properly documented. The package uses the public_member_api_docs lint rule to enforce documentation standards. Each public member should include:

  • A clear description of its purpose
  • Parameter descriptions with examples
  • Return value descriptions where applicable
  • Exception information where relevant

Example of proper documentation:

/// Translates text from one language to another.
///
/// [text] - The text to translate.
/// [fromCode] - The source language code (e.g., 'en' for English).
/// [toCode] - The target language code (e.g., 'ar' for Arabic).
///
/// Returns the translated text as a String.
static String translate(String text, String fromCode, String toCode)
3
likes
160
points
317
downloads
screenshot

Publisher

verified publisherabdelrhmantolba.online

Weekly Downloads

A Flutter package to automated translate localization keys from .arb files. and .json file offline and free

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

ffi, package_config, path

More

Packages that depend on argos_translator_offline