1. Go to this page and download the library: Download nativemind/wp-translation 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/ */
$browser_lang = nm_get_browser_language();
if ($browser_lang !== 'en') {
// Redirect to appropriate language site
nm_auto_redirect_language();
}
$flag = nm_get_flag_emoji('de'); // Returns 🇩🇪
// Access via browser
http://yoursite.com/wp-content/plugins/nativelang-wordpress/test_cache.php
// Or
// In wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
// Check logs at /wp-content/debug.log
bash
# Set in your server environment or wp-config.php
define('GOOGLE_TRANSLATE_API_KEY', 'your-api-key-here');
bash
# Copy the template and add your API key
cp translateTextGoogle.php.example translateTextGoogle.php
# Edit translateTextGoogle.php and add your API key
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.