diff --git a/src/libaudqt/util.cc b/src/libaudqt/util.cc
index 011f7e9..2ba680d 100644
--- a/src/libaudqt/util.cc
+++ b/src/libaudqt/util.cc
@@ -70,37 +70,14 @@ EXPORT const char * translate_str (const char * str, const char * domain)
     if (! str)
         return nullptr;
 
-    const char * src = str;
-
     if (domain)
-        src = dgettext (domain, src);
-
-    StringBuf buf (strlen (src));
-
-    /* translate the gtk+ accelerator (_) into a qt accelerator (&), so we don't break the
-     * translations.
-     *
-     * the translation rules are: if sentence begins with _ then translate, otherwise only
-     * translate if the previous character is a space.  the backtrack is safe as the first
-     * condition will match if we're at the beginning.
-     *
-     *    --kaniini
+        str = dgettext (domain, str);
+
+    /* translate the gtk+ accelerator (_) into a qt accelerator (&),
+     * so we don't break the translations.
      */
-    char * it = buf;
-    const char * rit = src;
-
-    for (; * rit; it++, rit++)
-    {
-        if (*rit == '_')
-        {
-            if (rit == src || *(rit - 1) == ' ')
-                *it = '&';
-            else
-                *it = *rit;
-        }
-        else
-            *it = *rit;
-    }
+    StringBuf buf = str_copy (str);
+    str_replace_char (buf, '_', '&');
 
     return buf;
 }
