If you use text under or alongside your toolbar icons, you might have the desire to change some of the texts to make them shorter, especially if you do not use english language texts. This tutorial describes the steps needed for KDE 4 applications. As an example, the goal is to change the text “Compare Files” to “Diff” in the Dolphin toolbar.

Step 1: Make sure the application uses “appnameui.rc”
Usually if an application allows editing the toolbars, it saves its custom configuration to a file ending in “ui.rc” in the .kde/share/apps/appname/ directory. To find out if an application really uses this file, simply change the toolbar of that application using the “Configure Toolbars …” dialog, and check if said file exists. For Dolphin, the file is .kde/share/apps/dolphin/dolphinui.rc
Note: This step might crash with some applications (bug reports are already filed). The configuration file is usually still saved correctly.
Step 2: Select the action that you want to edit
Change the icon of the toolbar action that you would like to change the text on. This is only required to get the proper “Action” entry generated in the ui.rc file. There is a “Change Icon …” button in the toolbar dialog that opens the icon selector. For this example, I changed the icon for the “Compare Files” action to the “edit-copy” icon.

Step 3: Change the ui.rc file using a text editor
Load the ui.rc file in a text editor. It is an XML file. Near the end of the file there is an <ActionProperties> tag. Inside this tag all modified actions appear:
<ActionProperties scheme="Default"> <Action icon="edit-copy" name="compare_files"/> </ActionProperties>
Now delete the “icon” property and replace it with the “iconText” property:
<ActionProperties scheme="Default"> <Action iconText="Diff" name="compare_files"/> </ActionProperties>
Save the file. This will do two things if you restart Dolphin: you get the original icon back, and the icon text is changed from “Compare File” to “Diff”.

Of course a real improvement would be if translators could simply provide two translations for the action texts, but KDE cannot handle it right now without the developer providing two translatable strings in the first place. I am currently investigating a solution for KDE 4.4, that does not add burden to translators or developers, and works with existing applications transparently. If I fail, I will add text customization from the toolbar edit GUI, as shown in the screen shot.
SeaJey said
Cool, I can use now “text-under-icons” again!
I had to choose “Icons only” because of the big translated texts.
sandsmark said
Why two translations? Why not just the shortest one?
kdepepo said
@sandsmark, for example, the text “Add Fonts” could be translated to “Schriftarten hinzufügen” in the menu, but should probably be abbreviated for the toolbar. So there would be two translated texts, where the developer only provided one “source” text.
JohnFlux said
Sounds like you want the new functions that will be in Qt 4.6.
Basically a single string can have multiple translations of different lengths. Then the longest translation for a given size will be used. That way you can have sort translations for toolbars, and longer translations for menus, etc.
Hans said
Neat trick, thanks for sharing!
I use “Text alongside icons” and want to remove the text from some icons, for example “Back” and “Forward”. Unfortunately doesn’t work, I have to use Action iconText=” ” (note the whitespace) which makes an empty space after the icon. Any hints?
kdepepo said
@Hans, selectively hiding texts from toolbar actions needs code modifications inside Qt or KDE, and the problem is already known. See https://bugs.kde.org/show_bug.cgi?id=175123
kdepepo said
@JohnFlux, I did not know about that feature yet. Is there any documentation available? I did not find anything in http://doc.trolltech.com/4.6-snapshot/qtranslator.html
Hans said
@kdepepo:
Thanks for the link. Yeah there should be better way to accomplish it, but I wanted to do it in this rather “hackish” way.
(By the way, a part of my text was removed, after “Unfortunately” there should be Action iconText=””).
SKaRCHa said
This comment is just to ask:
What font family are you using? It looks very clear.
And another question, how do you have configured anti-aliasing?
Thanks for your answer..
kdepepo said
@SKaRCHa, that’s Arial with “Slight” hinting. And I hate the color fringes and the missing gamma correction. Despite subpixel hinting turned off, Qt insists on using it. I wish my fonts would look better.
Bernhard H. said
Why not putting a long translation into the tool tip and show only a short one? For me (german) it seems like there is always just the same text as tooltip as on the icon.
Btw my fonts look nice.
kdepepo said
@Bernhard, the translator can currently only make two translations if the programmer puts two strings into the source code in the first place. If you change the action’s iconText as described in this tutorial, then the old (long) text will be used for the tool tip. Actually, if you really want, you can add a toolTip=”blabla” property to the ui.rc file and even change the tool tip independently.
Jakob Petsovits said
I wonder if using the “Change Text…” button instead of “Change Icon…” can save you from editing the .rc file.
Jakob Petsovits said
oh. er. just noticed that the “Change Text…” button is only present on your own system. please disregard/delete the above comment.