Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Giveaways Snippets | http://www.wpsimplegiveaways.com/
<?php
/**
* Plugin Name: Simple Giveaways - Translating strings
* Description: This file can be saved under wp-content/plugins or just paste the code in your theme's functions.php.
* Version: 1.0.0
*/
if ( ! defined('ABSPATH') ) {
return;
}
add_filter('gettext', 'simple_giveaways_translate_gettext', 20, 3);
/**
* Translate Simple Giveaways strings
*
* @param string $translated_text Text that you would see.
* @param string $original_text The original text that is translated. Usually in english.
* @param string $domain The domain. For Simple Giveaways, $domain is giveasap.
*/
function simple_giveaways_translate_gettext( $translated_text, $original_text, $domain ) {
if ( 'giveasap' !== $domain ) {
return $translated_text;
}
// Add/Remove based on your needs here.
// For each new text, create a case with the text you need to translate, add new $translated_text and break;
switch( $translated_text ) {
case 'Winners':
$translated_text = 'Members';
break;
case 'Your Current Entries':
$translated_text = 'Your Current Referral';
break;
case 'Winner Announcement':
$translated_text = 'Distribution date';
break;
}
return $translated_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.