Code Monkey home page Code Monkey logo

cakephp-transifex's Introduction

CakePHP Transifex Plugin

Build Status Coverage Status Minimum PHP Version License Total Downloads Coding Standards

A CakePHP 3.x plugin that works with Transifex and pulls/pushes translations. It uses the Transifex API v2.

Please note: New functionality has been tested against latest CakePHP 3.x version only. Please upgrade if possible.

Installation

Installing the plugin is pretty much as with every other CakePHP plugin.

  • composer require dereuromark/cakephp-transifex
  • Make sure you have Plugin::load('Transifex') or Plugin::loadAll() in your bootstrap

Create an account at transifex.com and create/join a project and resources.

Put the information regarding project, user and password in your config file or your bootstrap

$config['Transifex'] = [
	'project' => 'cakephp',
	'user' => '...',
	'password' => '...'
];

That's it. It should be up and running.

Usage

To get a list of supported resources for the current project:

cake Transifex.Transifex resources

To get a list of supported languages:

cake Transifex.Transifex languages

Statistics for a resource can be gathered using

cake Transifex.Transifex statistics

To actually update your Locale folder, use

cake Transifex.Transifex pull

It will prompt for language and resource (use * to import all).

A shortcut to import a specific language for a specific resource, you can also use

cake Transifex.Transifex pull -l {language} -r {resource}

The PO files will be stored in src/Locale/{locale}/LC_MESSAGES/{resource}.po. Using version control is highly recommended to quickly overview and confirm the changes made.

Advanced usage

You can pull reviewed translations only using --reviewed-only or -R:

cake Transifex.Transifex pull -R

To pull locales for a plugin you need to set --plugin or -p:

cake Transifex.Transifex pull -p Tools

They will then be stored in the plugin's Locale folder.

If you happen to have one primary project and several other (plugin or CakePHP core) projects, you can overwrite the config project setting using --project or -P:

cake Transifex.Transifex pull -P cakephp

Tip: If you want to dry-run it first, use -d -v. This will not modify your locale files but simulate the import.

Tips

You can use the auto-alias of Transifex.Transifex which is Transifex - or even a super-short t using custom aliasing.

Debugging

Use --debug to have more verbose debugging output when pushing via cURL.

Testing

When testing --debug enables live test mode and uses the actual API instead of mocking and fake JSON response files. Make sure you provide valid credentials in your tests/bootstrap.php for this. Also make sure those are not your live credentials to avoid data loss. You should use a dedicated test account here to be sure.

TODO

  • More tests

Disclaimer

Use at your own risk. Please provide any fixes or enhancements via issue or better pull request.

cakephp-transifex's People

Contributors

beinbm avatar dereuromark avatar jrbasso avatar zuluru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cakephp-transifex's Issues

Readme update

Nice plugin man!

I will be using it for a site in my job. Will let you know any ideas or errors.

For now the only thing that is "reviewable" is the syntax for the config specified in the readme file. Should be:

Configure::write('Transifex', array(
    'project' => '...',
    'user' => '...',
    'password' => '...'
));

I think that the actual syntax is Cake3 syntax.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.