Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2020 17:43
What would you like to do?
Simple Giveaways Snippets |
* 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') ) {
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';
case 'Your Current Entries':
$translated_text = 'Your Current Referral';
case 'Winner Announcement':
$translated_text = 'Distribution date';
return $translated_text;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment