Skip to content

Instantly share code, notes, and snippets.

@igorbenic
Created April 27, 2020 17:43
Show Gist options
  • Save igorbenic/73594852ade8dfc36a5abaafd9244a74 to your computer and use it in GitHub Desktop.
Save igorbenic/73594852ade8dfc36a5abaafd9244a74 to your computer and use it in GitHub Desktop.
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