weikaiiii / background-translation-i18n
Translate the i18n JSON file you need in the background of the website
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
- yiisoft/yii2-bootstrap: ~2.0.0
- yiisoft/yii2-jui: ~2.0.0
This package is auto-updated.
Last update: 2024-12-11 23:42:44 UTC
README
👽 Based on the YII2 module to translate JSON formatted translation files on the web
Introduction:sweat_drops:
This project is suitable for client-side international translation. It supports importing JSON files to web pages, and operation and maintenance or translators export the translated JSON files after translation on the web
Installation:green_heart:
Via Composer
composer require weikaiiii/background-translation-i18n
Migration:purple_heart:
Run the following command in Terminal for database migration:
yii migrate/up --migrationPath=@vendor/weikaiiii/background-translation-i18n/migrations
Config:heartbeat:
Turning on the translate Module:
Simple example:
'modules' => [
'translate' => [
'class'=>'weikaiiii\backgroundTranslationI18n\Module'
],
],
A more complex example including database table with multilingual support is below:
'modules' => [
'translate'=>[
'class'=>'weikaiiii\backgroundTranslationI18n\Module',
'allowedIPs'=>['127.0.0.1'], // IP addresses from which the translation interface is accessible.
'source_lang'=>'en-US', //Translate according to source language encoding.
]
],
Usage:no_mouth:
Point
Every time a JSON file is uploaded, it will be judged based on the existing data and will not cause data duplication.
Json File Format Example
{
"library":{
"hello":"Hello from library"
},
"documents":{
"hello":"Hello from documents"
}
}
URLs
URLs for the translating tool:
/translate/translate-json/export // Export the translated JSON file.
/translate/translate-json/index?language_id={xx-XX} // Translate specific language pages.
/translate/translate-json/list // Language code list page.
/translate/translate-json/create // Import JSON source language files.
Screenshots:chicken:
List of languages
Translate on the admin interface
Statement:love_letter:
The project view part and language list part are borrowed from the "lajax/yii2-translate-manager" project. Thanks lajax for the great work.
- YII2 Translate Manager : https://github.com/lajax/yii2-translate-manager