swiftyper/fbt-sync

Extension for automatic deployment of fbt framework translations for PHP

1.0.1 2022-07-30 11:49 UTC

This package is auto-updated.

Last update: 2022-11-30 12:30:12 UTC


README

FBT sync

This library allows you to import native phrases and automatically deploy reviewed translations.

Get started with Swiftyper Translations

Requirements

  • PHP 7.0 or higher

📦 Installing

$ composer require swiftyper/fbt-sync

🔧 Configuration

These steps are required:

  1. Register your FBT project on Swiftyper Translations

  2. Create config file and adjust the values accordingly for file swiftyper_config.php:

    $ php ./vendor/bin/swiftyper fbt --config
  3. Init project settings:

    $ php ./vendor/bin/swiftyper fbt --init
  4. [OPTIONAL] If you want to use automatic import & deploy:

    • Create this 3 POST endpoints:

      $swiftyper = new \Swiftyper\fbt\SwiftyperIntlRouter();
      
      // yourdomain.com/intl/sync:
      $swiftyper->sync();
      
      // yourdomain.com/intl/deploy:
      $swiftyper->deploy();
      
      // yourdomain.com/intl/upload:
      $swiftyper->upload();

Options

A swiftyper_config.php file will be stored in your project root. Edit the contents of this file and adjust the values accordingly. You need to provide a valid Swiftyper api_token value:

  • api_key string: Project API key (required)
  • verify_signature bool: Verify signature from response
    • fbt:
      • path string: Cache storage path for generated translations & source strings
      • hash_module string: Hash module
      • md5_digest string: MD5 digest

🚀 Command

php ./vendor/bin/swiftyper

Options

Option Description
--deploy Deploy reviewed app translations
--upload=[path] Upload phrases/translations to swiftyper
--init Connect fbt project with swiftyper
--config Creates swiftyper_config.php in your project root
--pretty Pretty print output

📜 License

The MIT License (MIT). Please see LICENSE for more information.