Please or Register to create posts and topics.

Change specific translated strings

The following code contains some examples on how to change specific translated strings to a custom one without creating/changing a complete translation file. The modified strings will not affect similar strings generated by other plugins.

As usual you have to add this code to your themes functions.php file.

add_filter('ngettext', 'change_ntranslations', 20, 5);
add_filter('gettext', 'change_translations', 20, 3);

function change_translations($translated_text, $untranslated_text, $domain) {
  if ($domain === 'asgaros-forum') {
    switch ($translated_text) {
      case 'Forum':
        $translated_text = 'My Board';
      break;
      case '%s Topics':
        $translated_text = '%s Threads';
      break;
      case '%s Topic':
        $translated_text = '%s Thread';
      break;
      case 'Last post':
        $translated_text = '';
      break;
    }
  }

  return $translated_text;
}

function change_ntranslations($translated_text, $single, $plural, $number, $domain) {
  if ($domain === 'asgaros-forum') {
    $translated_text = change_translations($translated_text, '', 'asgaros-forum');
  }

  return $translated_text;
}

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hello Asgaros,

I´m just exploring the plugin´s characteristics before installation. Is there a way to apply these translations to a specific forum among others? Maybe using its shortcode to assign the translation specifically to it?

Julia

Quote from Deleted user on September 11, 2021, 2:38 am

Hello Asgaros,

I´m just exploring the plugin´s characteristics before installation. Is there a way to apply these translations to a specific forum among others? Maybe using its shortcode to assign the translation specifically to it?

Julia

It offers a translation management system and translation feature that helps you to create your desired language option on your website.

mapquest driving directions smash karts