Giter VIP home page Giter VIP logo

openl10n-cli's Introduction

OpenLocalization CLI tool

Build status... Code quality... License MIT Packagist Dependency Status

Install

Download the last PHAR file from the releases panel and add it to your $PATH:

VERSION=vX.X.X
curl -LO "https://github.com/openl10n/openl10n-cli/releases/download/${VERSION}/openl10n.phar"
chmod +x openl10n.phar
mv openl10n.phar /usr/local/bin/openl10n

Or clone the source and build it manually using Composer and Box Project.

git clone https://github.com/openl10n/openl10n-cli.git; cd openl10n-cli
composer install
box build
mv openl10n.phar /usr/local/bin/openl10n

You can also include it directly in a PHP project by adding it in your Composer dependencies:

composer require openl10n/cli

Usage

Write a .openl10n.yml file on the root of your project:

# Server configuration
server:
    hostname: openl10n.dev # Location of your openl10n instance
    port: 80               # Specify port if needed (optional)
    use_ssl: true          # If openl10n is protected by ssl (optional)
    username: user         # User credentials (login)
    password: userpass     # User credentials (password)

# Project identifier
project: foobar

# Path to the translation files
files:
    # Example of patterns for a standard Symfony application
    - pattern: app/Resources/translations/*.<locale>.*
    - pattern: src/*Bundle/Resources/translations/*.<locale>.*

If you use versionning with this configuration file then it's better to specify server credentials outside of the project.

You can use an alias in the .openl10n.yml file:

# Server configuration
server: foobar

and reference the credentials for this alias into the $HOME/.openl10n/server.conf file:

[foobar]
hostname: openl10n.dev
port: 80
use_ssl: true
username: user
password: userpass

Upload translations:

openl10n push --locale=all

Download translations:

openl10n pull --locale=all

Select files to upload

You can select the files you want to push to the server by adding a file name list at the end of the command:

openl10n push --locale=all app/Resources/fr.yml config/translations/de.yml

Select files to download

Same thing here:

openl10n pull --locale=all app/Resources/fr.yml config/translations/de.yml

License

OpenLocalization is released under the MIT License. See the bundled LICENSE file for details.

openl10n-cli's People

Contributors

b-durand avatar franmomu avatar jdeniau avatar mattketmo avatar nervo avatar olaurendeau avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

openl10n-cli's Issues

[Init] auto detect pattern

Add rules to detect file patterns automatically.

For instance, in a Symfony2 app, find files under pattern src/**/*Bundle/Resources/translations/*, and if matching, suggest default patterns on init command.

Recursive glob pattern

Allow recursive glob pattern (**) when finding files.
Example for a Symfony project:

src/**/*Bundle/Resources/translations/*.<locale>.yml

Read conf from file

Example of configuration file

server:
    host: openl10n.local
    login: user
    password: user

project: foobar

files:
    expr: 
        - src/Acme/Bundle/*/Resources/translations/<domain>.<local>.*
        - strings/<locale>/LC_MESSAGES/<domain>.*
    exclude: messages.en.yml

options: ~

Or specify credentials in user's home directory (~/.openl10n.yml):

hosts:
    openl10n.dev:
        user: user
        password: user
        #use_ssl: true

Then only use:

server: openl10n.dev

The "working-dir" option does not exist.

When installling on a directory-level, I got this error.

I think you can reproduce it like this:

mkdir test;
cd test;
composer require openl10n/cli;
vendor/openl10n/cli/bin/openl10n init;

The pull command does not work either when in a openl10n-managed directory

(Re) implements options for push & pull commands

See

files:
  - 
    pattern: path/to/<locale>.yml
    # File set specific options
    options: 
       push: [reviewed, erase, clean]
       pull: [reviewed, fallback_locale, fallback_key]

# Global options
options:
  push: [reviewed, erase, clean]
  pull: [reviewed, fallback_locale, fallback_key]

push command filter

Hi,

It would be nice if we could filter some files to push (and/or pull), because the upload may be slow.

If you know that you have modified only one file, you do not want to push all files. This way, we can develop post-commit hooks or something like that.

I started to dive into the push code friday, but how do you see that:

  • Does it needs to be in the sdk (I don't know why but it can be usefull to filter your resources):
    • pro: will work on all potential client
    • con: I think it will not work if you add a new file
  • or just in the cli command

Tell me how you see it and I will push you some code.

Thanks
Julien

Pull a specific file / folder

First of all thanks a lot for this awesome project. I've been thinking about something like openl10n for a long time.

As openl10n.phar allow to push a specific file, I think that it make sense to be able to pull a specific file / folder.
We have been able to bypass this by creating various configuration files. But it's not really reliable.

If you validate this feature, we will try to implement it. :)

Empty .openl10n.yml

PHP Catchable fatal error:  
Argument 1 passed to Openl10n\Cli\ServiceContainer\ExtensionManager::load() 
must be of the type array, null given, called in src/Openl10n/Cli/Application.php on line 103 
and defined in src/Openl10n/Cli/ServiceContainer/ExtensionManager.php on line 47

Issue when building the phar

Hi!

I get the following error when I'm building the phar:

  [RuntimeException]
  The file "/Users/someuser/Work/tools/openl10n-cli/vendor/guzzlehttp/guzzle/src/cacert.pem" does not exist or is not a file.

Box version:

Box version 2.6.1 build c9ee902145324690459664bd938ed31475d58347

Add option to export to different path

Example of conf file:

server: openl10n.dev
project: demo
files:
    expr: src/Openl10n/Bundle/*/Resources/translations/<domain>.<locale>.*
    export_to: app/Resources/translations/<domain>.<locale>.xlf

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.