Project

General

Profile

Bug #469

Qt: Accelerators are not translated correctly

Added by Thomas Lange over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Minor
Assignee:
-
Category:
libaudqt
Target version:
Start date:
October 14, 2014
Due date:
% Done:

100%

Estimated time:
Affects version:

Description

translate_str() in libaudqt/util.cc
assumes the accelerator is always the prefix of a single word.
This is not always true.

Some accelerators are conventions or are placed somewhere else to prevent conflicts.

My suggestion is to translate the first underscore in all cases.
At least for the German translation this has no side effects.

Example.png (3.55 KB) Example.png Button with wrong accelerator Thomas Lange, October 14, 2014 16:27
translate_str.patch (1.34 KB) translate_str.patch Thomas Lange, October 18, 2014 17:35

History

#1 Updated by John Lindgren over 9 years ago

How about using str_replace_char()?

#2 Updated by Thomas Lange over 9 years ago

I think that's fine.
All translated strings should contain only one accelerators already.
And I doubt that translators use underscores for other purposes than accelerators.

#3 Updated by Ariadne Conill over 9 years ago

My concern with str_replace_char() is multibyte safety, i.e. CJK translations. If you want to change the behaviour to translate the first underscore always, that is fine.

#4 Updated by Thomas Lange over 9 years ago

  • File 01_translate_str.patch added
  • File 02_translate_str.patch added

John, what do you think about this?
Can str_replace_char() be used for these translations?

If not, we can use one of the attached patches.

#5 Updated by John Lindgren over 9 years ago

William Pitcock wrote:

My concern with str_replace_char() is multibyte safety, i.e. CJK translations. If you want to change the behaviour to translate the first underscore always, that is fine.

All of our translations are UTF-8, so multibyte characters should (thankfully) not be an issue.

#6 Updated by Thomas Lange over 9 years ago

  • File 03_translate_str.patch added

OK, please take a look on the attached patch.

Two questions:
Is str_copy() the right function to use here or should it be str_to_utf8()?
What is the intention of "src"? Using "str" instead also works correctly.

#7 Updated by John Lindgren over 9 years ago

The translations are already UTF-8, so str_to_utf8() is unnecessary. You can use str directly if you want, there's no difference either way.

#8 Updated by Thomas Lange over 9 years ago

  • File deleted (01_translate_str.patch)

#9 Updated by Thomas Lange over 9 years ago

  • File deleted (02_translate_str.patch)

#10 Updated by Thomas Lange over 9 years ago

  • File deleted (03_translate_str.patch)

#11 Updated by Thomas Lange over 9 years ago

Updated patch attached.

#12 Updated by John Lindgren over 9 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

I committed a patch that uses QString::replace(). QString is what we eventually need anyway, so there's no reason to use the intermediate StringBuf.

Also available in: Atom PDF