PHP code example of whitedigital-eu / translation-bundle
1. Go to this page and download the library: Download whitedigital-eu/translation-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
whitedigital-eu / translation-bundle example snippets
return [
// ...
WhiteDigital\Translation\TranslationBundle::class => ['all' => true],
];
use WhiteDigital\Translation\Entity\AbstractTranslatableEntity;
use Gedmo\Mapping\Annotation as Gedmo;
class YourEntity extends AbstractTranslatableEntity
{
#[Gedmo\Translatable]
private ?string $name = null;
// ... getters and setters
}
json
{
"key": "translation.key",
"domain": "messages",
"translations": {
"en": "English translation",
"lv": "Latvian translation"
}
}