The theme function theme_uc_usps_option_label() assumes the service name string starts with 'U.S.P.S. ' and truncates the first 9 letters of it. When using a translation of Ubercart, in my case is spanish, the service name string doesn't start with those letter thus the code truncates part of the name (the first 9 letters to be exact). This is an easy fix, though. Just replace the following in line 496 of uc_usps.module:

$output .= substr($service, 9);

with this:

$output .= str_replace('U.S.P.S. ', '', $service);

I would submit a patch but I don't know how. I know this could be done overriding the theme function in template.php of your theme but maybe is safer this way. I think assuming a string will start with a particular set of letters when the string is loaded dynamically is a bit wrong.

Comments

longwave’s picture

Status: Active » Fixed

Fix committed to both branches. I modified it slightly, ensuring that U.S.P.S. is only removed from the start of the string, added a space between the image and the service name as this looks a bit better, and changed the alt text to U.S.P.S. so if the image is unavailable, the service name will still show correctly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.