agency-orgo/string-translations
最新稳定版本:v2.6.0
Composer 安装命令:
composer require agency-orgo/string-translations
包简介
A Statamic addon for managing string translations
README 文档
README
A Statamic addon for managing string translations with database storage and fallback support.
Features
- Database-driven string translations
- Multi-language support with fallback hierarchy
- Bulk operations for performance
- Search and filter functionality
- Control Panel integration
- REST API and GraphQL support
Installation
You can install this addon via Composer:
composer require agency-orgo/string-translations
Usage
After installation, you'll find "String Translations" in your Statamic Control Panel under Utilities.
Configuration
Publish the config file:
php artisan vendor:publish --tag=string-translations-config
return [ 'database' => [ 'connection' => env('STRING_TRANSLATIONS_DB_CONNECTION', 'default'), 'table' => env('STRING_TRANSLATIONS_TABLE', 'localized_strings'), ], 'api' => [ 'enabled' => env('STRING_TRANSLATIONS_API_ENABLED', false), ], ];
REST API
Enable with STRING_TRANSLATIONS_API_ENABLED=true in your .env.
Fetch translations:
curl "https://your-site.com/!/string-translations/strings?lang=en"
Create keys:
curl -X POST "https://your-site.com/!/string-translations/strings" \ -H "Content-Type: application/json" \ -d '{"keys": ["nav.home", "nav.about"]}'
GraphQL
Automatically available when Statamic's GraphQL is enabled (STATAMIC_GRAPHQL_ENABLED=true). No additional configuration needed.
Fetch translations
{
string_translations(lang: "en") {
lang
strings
}
}
Response:
{
"data": {
"string_translations": {
"lang": "en",
"strings": {
"nav.home": "Home",
"welcome.message": "Welcome!"
}
}
}
}
Create translation keys
Creates keys across all configured sites with an untranslated_ prefix.
mutation { createStringTranslations(keys: ["nav.contact", "footer.copyright"]) { created } }
Response:
{
"data": {
"createStringTranslations": {
"created": 12
}
}
}
The created count reflects total rows inserted (keys * sites). Duplicate keys are ignored.
Requirements
- Statamic 6.0+
- PHP 8.3+
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-20