Machine Translation
- Machine Translation Server Configuration
This article details the server configuration required for enabling and optimizing Machine Translation features within MediaWiki 1.40. This guide assumes you have a functioning MediaWiki installation and are familiar with basic server administration tasks. We will cover the necessary software, hardware considerations, and configuration steps. This is a complex setup and requires careful attention to detail. Please consult the Manual:Configuration for general MediaWiki configuration guidance.
Overview
Machine Translation allows users to translate wiki content automatically using various machine translation APIs. This significantly reduces the workload for volunteer translators and makes content accessible to a wider audience. This configuration focuses on setting up the server infrastructure to support this feature, rather than configuring the translation interface itself (see Manual:TranslationExtension for that). Successful implementation depends on reliable network connectivity to the translation service providers and sufficient server resources to handle the increased load.
Software Requirements
The following software components are essential for machine translation functionality:
- PHP 7.4 or higher: Required by MediaWiki 1.40. Ensure the necessary PHP extensions are installed (see Manual:PHP for details).
- MediaWiki 1.40: The core wiki software.
- Translation Extension: The extension that provides the translation interface and integrates with the machine translation services. Install using the Manual:Extensions guide.
- cURL: PHP cURL extension is *mandatory* for making API requests to translation services.
- JSON Support: PHP JSON support is also *mandatory*.
The following table summarizes the software requirements:
Software | Version | Required |
---|---|---|
PHP | 7.4+ | Yes |
MediaWiki | 1.40 | Yes |
Translation Extension | Latest | Yes |
cURL (PHP Extension) | Latest | Yes |
JSON (PHP Extension) | Latest | Yes |
Hardware Considerations
Machine translation can be resource-intensive, especially with high traffic volumes. Proper hardware is crucial for maintaining performance. Consider the following:
- CPU: A multi-core processor is recommended. The number of cores depends on the anticipated load.
- RAM: At least 8GB of RAM is recommended, with 16GB or more for larger wikis.
- Storage: SSD storage is highly recommended for faster I/O operations.
- Network Bandwidth: A stable and high-bandwidth internet connection is essential.
The following table provides example hardware configurations based on wiki size:
Wiki Size | CPU | RAM | Storage | Network Bandwidth |
---|---|---|---|---|
Small ( < 10,000 pages) | 4 Core | 8GB | 256GB SSD | 100 Mbps |
Medium (10,000 - 100,000 pages) | 8 Core | 16GB | 512GB SSD | 500 Mbps |
Large ( > 100,000 pages) | 16+ Core | 32GB+ | 1TB+ SSD | 1 Gbps+ |
Configuration Steps
1. Install the Translation Extension: Follow the instructions at Manual:Extensions to install and enable the Translation Extension. 2. Configure Localisation: Ensure your wiki is properly localized. See Manual:$wgLocalisationDirectory for further instructions. 3. API Credentials: Obtain API keys from your chosen machine translation service providers. Common options include Google Translate, DeepL, and Microsoft Translator. Store these credentials securely. *Never* commit API keys to version control. 4. `LocalSettings.php` Configuration: Modify your `LocalSettings.php` file to configure the translation extension and API keys. Add the following lines (replace placeholders with your actual values):
```php $wgTranslationAutoLoad = true; $wgTranslationEnableMachineTranslation = true; $wgTranslationProviders = [
'GoogleTranslate' => [ 'apiKey' => 'YOUR_GOOGLE_TRANSLATE_API_KEY', 'host' => 'translate.google.com', ], 'DeepL' => [ 'apiKey' => 'YOUR_DEEPL_API_KEY', 'host' => 'api-free.deepl.com', ],
]; $wgTranslationAutoDetectLanguage = true; ```
5. Caching Configuration: Implement caching to reduce the load on the translation APIs. Consider using a caching system like Memcached or Redis. Refer to Manual:Caching for configuration details.
6. Rate Limiting: Implement rate limiting to prevent abuse of the machine translation services and avoid exceeding API usage limits. This can be done through server-level configurations or by using a PHP library. See Manual:RateLimiting for more information.
7. Logging and Monitoring: Enable logging to track machine translation usage and identify potential issues. Monitor server resources (CPU, RAM, network) to ensure optimal performance. Consider using a monitoring tool like Prometheus or Grafana.
The following table summarizes the key configuration parameters:
Parameter | Description | Location |
---|---|---|
`$wgTranslationAutoLoad` | Enables automatic loading of translation messages. | `LocalSettings.php` |
`$wgTranslationEnableMachineTranslation` | Enables machine translation functionality. | `LocalSettings.php` |
`$wgTranslationProviders` | Defines the machine translation service providers and their API keys. | `LocalSettings.php` |
`$wgTranslationAutoDetectLanguage` | Automatically detects the source language. | `LocalSettings.php` |
Security Considerations
- API Key Security: Protect your API keys. Do not expose them in public repositories or client-side code.
- Input Validation: Validate all input to prevent injection attacks.
- Rate Limiting: Implement rate limiting to prevent abuse.
- Regular Updates: Keep your MediaWiki installation and extensions up to date to benefit from security patches. See Manual:Upgrading for upgrade instructions.
Troubleshooting
- API Errors: Check the wiki's error logs for API errors. Ensure your API keys are valid and your network connection is stable. Refer to the documentation for your chosen translation service provider for specific error codes.
- Performance Issues: Monitor server resources and optimize caching. Consider using a more powerful server if necessary.
- Translation Quality: Machine translation quality can vary. Encourage human review and editing of translated content.
Further Resources
- Manual:TranslationExtension
- Manual:Configuration
- Manual:PHP
- Manual:Caching
- Manual:RateLimiting
- Manual:Upgrading
- [Google Translate API](https://cloud.google.com/translate/)
- [DeepL API](https://www.deepl.com/pro-api)
- [Microsoft Translator API](https://azure.microsoft.com/en-us/services/cognitive-services/translator/)
Intel-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Core i7-6700K/7700 Server | 64 GB DDR4, NVMe SSD 2 x 512 GB | CPU Benchmark: 8046 |
Core i7-8700 Server | 64 GB DDR4, NVMe SSD 2x1 TB | CPU Benchmark: 13124 |
Core i9-9900K Server | 128 GB DDR4, NVMe SSD 2 x 1 TB | CPU Benchmark: 49969 |
Core i9-13900 Server (64GB) | 64 GB RAM, 2x2 TB NVMe SSD | |
Core i9-13900 Server (128GB) | 128 GB RAM, 2x2 TB NVMe SSD | |
Core i5-13500 Server (64GB) | 64 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Server (128GB) | 128 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Workstation | 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000 |
AMD-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Ryzen 5 3600 Server | 64 GB RAM, 2x480 GB NVMe | CPU Benchmark: 17849 |
Ryzen 7 7700 Server | 64 GB DDR5 RAM, 2x1 TB NVMe | CPU Benchmark: 35224 |
Ryzen 9 5950X Server | 128 GB RAM, 2x4 TB NVMe | CPU Benchmark: 46045 |
Ryzen 9 7950X Server | 128 GB DDR5 ECC, 2x2 TB NVMe | CPU Benchmark: 63561 |
EPYC 7502P Server (128GB/1TB) | 128 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/2TB) | 128 GB RAM, 2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/4TB) | 128 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/1TB) | 256 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/4TB) | 256 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 9454P Server | 256 GB RAM, 2x2 TB NVMe |
Order Your Dedicated Server
Configure and order your ideal server configuration
Need Assistance?
- Telegram: @powervps Servers at a discounted price
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️