Short KDE Toolbar Texts

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.

Dolphin toolbar with long icon text

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.

Dolphin's “Configure Toolbar ...” dialog

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"/>

Now delete the “icon” property and replace it with the “iconText” property:

 <ActionProperties scheme="Default">
  <Action iconText="Diff" name="compare_files"/>

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”.

Dolphin toolbar with short icon text

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.

14 thoughts on “Short KDE Toolbar Texts”

  1. @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.

  2. 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.

  3. 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?

  4. @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=””).

  5. 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.. 😉

  6. @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.

  7. 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.

  8. @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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s