Bug #466

Qt: Translations are not applied

Added by Thomas Lange almost 3 years ago. Updated about 2 years ago.

Status:Closed Start date:October 14, 2014
Priority:Major Due date:
Assignee:- % Done:

100%

Category:plugins/qtui
Target version:3.7
Affects version:

Description

Almost all strings are shown in English with the Qt interface.

Only some window titles and buttons use the translations
(screenshot of the settings window is attached).

Platform: Linux

Settings.png - Settings window (42.1 kB) Thomas Lange, October 14, 2014 15:58

translate_qt_buttons.patch Magnifier (4 kB) Thomas Lange, February 12, 2015 19:09

Associated revisions

Revision f198557d
Added by John Lindgren almost 3 years ago

libaudqt: Translation fixes. Closes: #466 (partly), #469. * translate_str() now replaces all '_' with '&' * translate_str() no longer returns a pointer into a deleted StringBuf * prefs_populate() now passes the correct gettext domain to widget constructors

Revision 8bdeb879
Added by John Lindgren almost 3 years ago

libaudqt: Fix menus not being translated. Partially closes: #466.

History

#1 Updated by John Lindgren almost 3 years ago

  • Category changed from libaudqt to plugins/qtui
  • Priority changed from Blocker to Major
  • Target version deleted (3.6)

I don't think this should be a blocker for 3.6 since the Qt UI is only going to be a technical preview in that release. Some of the translations will not appear without a fair amount of work, since Qt Designer does not support our gettext-based translations.

#2 Updated by William Pitcock almost 3 years ago

I am planning to remove the last bits of the Qt Designer stuff this weekend.

#3 Updated by John Lindgren almost 3 years ago

I fixed several issues in the PreferencesWidget code; all of the settings dialog should be translated now.

#4 Updated by Thomas Lange almost 3 years ago

  • Status changed from New to In Progress

Thanks John, good work.
I just fixed some remaining issues.

TODO:
- menu bar
- dialog buttons
- combobox "Preferences->Audio->Bit depth"
- combobox "Preferences->Playlist->Auto character encoding detector for:"
- tooltip "Close Tab" on tab close buttons

The dialog buttons and the tooltip should be translated by Qt, but apparently they are not.
We could either use custom QPushButtons or something like this:

     m_buttonbox.setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+    m_buttonbox.button (QDialogButtonBox::Ok)->setText (translate_str ("_OK"));
+    m_buttonbox.button (QDialogButtonBox::Cancel)->setText (translate_str ("_Cancel"));

#5 Updated by William Pitcock almost 3 years ago

Qt designer vestiges have been nuked. The menus should now be translated.

#6 Updated by Thomas Lange almost 3 years ago

At first it still used the English strings, but the fix was trivial.
Using () instead of N() resolved it.

#7 Updated by William Pitcock almost 3 years ago

That fix is incorrect. Please revert.

#8 Updated by Thomas Lange almost 3 years ago

Done, sorry for the inconvenience.
What is the proper fix though?

#9 Updated by William Pitcock almost 3 years ago

Please try latest libaudqt, it should have an appropriate fix.

#10 Updated by Thomas Lange almost 3 years ago

It is the same as before, still not translated.

#11 Updated by William Pitcock almost 3 years ago

Best to leave it to jlindgren then, the current approach is the same as libaudgui basically.

#12 Updated by William Pitcock almost 3 years ago

Qt itself can be translated by installing a custom translator which is subclassed from QTranslator. I'll work on that this weekend, it might help.

#13 Updated by John Lindgren almost 3 years ago

William Pitcock wrote:

Best to leave it to jlindgren then, the current approach is the same as libaudgui basically.

One of the pitfalls of this approach is that it's easy for the gettext domain to get dropped at some point in the call tree. There were a couple of places where this was happening in libaudqt. Menu translations should be fixed now.

#14 Updated by Thomas Lange almost 3 years ago

John Lindgren wrote:

Menu translations should be fixed now.

Thanks, confirming it works.

#15 Updated by Thomas Lange almost 3 years ago

Another issue remains in the file dialog (libaudqt/fileopener.cc#46).

If we translate the button label with "translate_str (N_("_Add"))", the accelerator
is converted to the Qt one (&). But Qt itself uses on GTK systems a native GTK dialog
and in this case the string is shown literally as "&Add".
If we just use _("_Add"), the accelerator is wrong on Qt systems.

Additionally it would be nice to show an icon on this button.

#16 Updated by Thomas Lange over 2 years ago

With the attached patch all dialog buttons are translatable.
The strings are already used in the GTK interface so no further translation work is needed.

My suggestion is to use this solution until William implements a custom QTranslator.

#17 Updated by John Lindgren over 2 years ago

Looks fine to me.

#18 Updated by Thomas Lange over 2 years ago

  • Affects version deleted (3.6)

Update for 3.7-devel:

PreferencesWidgets in "/skins-qt/skins_cfg.cc" are not shown translated currently.

#20 Updated by John Lindgren about 2 years ago

  • Status changed from In Progress to Closed
  • Target version set to 3.7
  • % Done changed from 0 to 100

Closing this since it looks like the issues have all been fixed.

Also available in: Atom PDF