nicmart/getlocalization 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nicmart/getlocalization

Composer 安装命令:

composer require nicmart/getlocalization

包简介

A simple php client for GetLocalization

README 文档

README

GetLocalization is a simple php client for the GetLocalization File Management api.

Build Status

Install

The best way to install GetLocalization is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "nicmart/getlocalization": "dev-master"
    }
}

Then you can run these two commands to install it:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

or simply run composer install if you have have already installed the composer globally.

Then you can include the autoloader, and you will have access to the library classes:

<?php
require 'vendor/autoload.php';

use GetLocalization\Client;

Initialization

All you have to do is to instantiate a new Client object, passing to its constructor your GetLocalization username and password and the name of your project:

<?php
    $client = new GetLocalization\Client('username', 'password', 'projectname');

Api calls

This library offers an one-to-one mapping with the GetLocalization File Management API. And that's all. Managing merging of your local files with GetLocalization ones is up to you.

Managing master files

Create a new master file

/**
 * @param string $format    The format of the master file
 * @param string $language  The language of the master file
 * @param string $filePath  The path of the local file to upload as master file
 */
$client->createMaster($format, $language, $filePath);

Update a master file

/**
 * @param string $filePath  The path of the local file to upload as master file
 */
$client->updateMaster($filePath);

Be careful here to pass a file path of a file that has the same name of the master file you want to update.

List all master files

/**
 * List master files
 *
 * @return array    A php array that is the json-decoded response of the get call
 */
$client->listMaster();

Managing Translations

Get a translation

/**
 * @param string $masterfile    The name of the masterfile 
 * @param string $lang          The lang of the translation
 * @return string               The content of the translation
 */
$client->getTranslation($masterfile, $lang);

Update a translation

/**
 * @param string $masterfile    The name of the masterfile
 * @param string $lang          The lang of the translation being uploaded
 * @param string $filePath      The path of the local translation file
 * @return mixed
 */
$client->updateTranslation($masterfile, $lang, $filePath);

Get a list of all translations

Not implemented yet

Get a zipped archive of all translations

/**
 * Download all translations in zip format
 */
$client->getZippedTranslations();

CREDITS

Tests

$ phpunit

License

MIT, see LICENSE.

统计信息

  • 总下载量: 278
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-03-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固