init
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class DeepLApiUrl implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => 'https://api-free.deepl.com/v2/translate',
|
||||
'label' => 'https://api-free.deepl.com/v2/translate',
|
||||
],
|
||||
[
|
||||
'value' => 'https://api.deepl.com/v2/translate',
|
||||
'label' => 'https://api.deepl.com/v2/translate',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class DeepLFormality implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
['value' => 'default', 'label' => __('Default')],
|
||||
['value' => 'prefer_more', 'label' => __('Prefer formal')],
|
||||
['value' => 'prefer_less', 'label' => __('Prefer informal')],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class GoogleLocation implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
['value' => 'global', 'label' => __('Global (standard translation)')],
|
||||
['value' => 'us-central1', 'label' => __('US Central 1 (required for Glossary)')],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class LogStatus implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
['value' => 'success', 'label' => __('Success')],
|
||||
['value' => 'failed', 'label' => __('Failed')],
|
||||
['value' => 'copied', 'label' => __('Copied (same language)')],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class QueueStatus implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
['value' => 'pending', 'label' => __('Pending')],
|
||||
['value' => 'processing', 'label' => __('Processing')],
|
||||
['value' => 'success', 'label' => __('Success')],
|
||||
['value' => 'failed', 'label' => __('Failed')],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class SkippedFields implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
$this->group('Category', 'category', [
|
||||
'name' => 'Name',
|
||||
'description' => 'Description',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_keywords' => 'Meta Keywords',
|
||||
'meta_description' => 'Meta Description',
|
||||
]),
|
||||
$this->group('Product', 'product', [
|
||||
'name' => 'Name',
|
||||
'description' => 'Description',
|
||||
'short_description' => 'Short Description',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_keyword' => 'Meta Keywords',
|
||||
'meta_description' => 'Meta Description',
|
||||
]),
|
||||
$this->group('CMS Page', 'cms_page', [
|
||||
'title' => 'Title',
|
||||
'content_heading' => 'Content Heading',
|
||||
'content' => 'Content',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_keywords' => 'Meta Keywords',
|
||||
'meta_description' => 'Meta Description',
|
||||
]),
|
||||
$this->group('CMS Block', 'cms_block', [
|
||||
'title' => 'Title',
|
||||
'content' => 'Content',
|
||||
]),
|
||||
$this->group('Blog Post', 'blog_post', [
|
||||
'name' => 'Post Name',
|
||||
'short_description' => 'Short Description',
|
||||
'post_content' => 'Content',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_keywords' => 'Meta Keywords',
|
||||
'meta_description' => 'Meta Description',
|
||||
]),
|
||||
$this->group('Wiki Category', 'wiki_category', [
|
||||
'title' => 'Title',
|
||||
'summary' => 'Summary',
|
||||
'content' => 'Content',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_description' => 'Meta Description',
|
||||
'meta_keywords' => 'Meta Keywords',
|
||||
]),
|
||||
$this->group('Wiki Homepage', 'wiki_homepage', [
|
||||
'title' => 'Title',
|
||||
'content' => 'Content',
|
||||
'meta_title' => 'Meta Title',
|
||||
'meta_description' => 'Meta Description',
|
||||
'meta_keywords' => 'Meta Keywords',
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
private function group(string $label, string $entityType, array $fields): array
|
||||
{
|
||||
$options = [];
|
||||
foreach ($fields as $field => $fieldLabel) {
|
||||
$options[] = [
|
||||
'value' => $entityType . '.' . $field,
|
||||
'label' => __($fieldLabel),
|
||||
];
|
||||
}
|
||||
|
||||
return ['label' => __($label), 'value' => $options];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Esun\MultiLocaleTranslation\Model\StoreViewProvider;
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class StoreViews implements OptionSourceInterface
|
||||
{
|
||||
public function __construct(private readonly StoreViewProvider $storeViewProvider)
|
||||
{
|
||||
}
|
||||
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
$options = [['value' => 0, 'label' => __('Default Store View (0)')]];
|
||||
foreach ($this->storeViewProvider->getStoreViewOptions() as $store) {
|
||||
$options[] = [
|
||||
'value' => $store['store_id'],
|
||||
'label' => sprintf(
|
||||
'%s / %s (%s)',
|
||||
$store['label'],
|
||||
$store['website'],
|
||||
$store['code']
|
||||
),
|
||||
];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class TranslationProvider implements OptionSourceInterface
|
||||
{
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
['value' => 'deepl', 'label' => __('DeepL')],
|
||||
['value' => 'google', 'label' => __('Google Cloud Translation V3')],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user