maxoplata/simple-locize
最新稳定版本:v1.0.0
Composer 安装命令:
composer require maxoplata/simple-locize
包简介
A lightweight library for handling translations via the Locize API
README 文档
README
Simple Locize is a PHP library for handling translations via the Locize API. Locize is a translation management system that allows you to easily manage your application's translations.
Installation
You can install Simple Locize via Composer. Run the following command in your terminal:
composer require maxoplata/simple-locize
Usage
To use Simple Locize, you first need to create an instance of the SimpleLocize class:
use Maxoplata\SimpleLocize; $projectId = 'your-project-id'; $environment = 'your-environment'; $privateKey = 'your-private-key'; // optional $locize = new SimpleLocize($projectId, $environment, $privateKey);
Fetching translations
To fetch translations for a specific namespace and language, you can use the getAllTranslationsFromNamespace method:
$namespace = 'your-namespace'; $language = 'en'; $translations = $locize->getAllTranslationsFromNamespace($namespace, $language);
This will return an object containing all translations for the specified namespace and language.
Translating a key
To translate a specific key for a namespace and language, you can use the translate method:
$namespace = 'your-namespace'; $language = 'en'; $key = 'your.key'; $translation = $locize->translate($namespace, $language, $key);
This will return the translation for the specified key, or the key itself if no translation is found.
License
Simple Locize is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-21