Bug #469
Qt: Accelerators are not translated correctly
100%
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.
History
#1 Updated by John Lindgren about 10 years ago
How about using str_replace_char()?
#2 Updated by Thomas Lange about 10 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 about 10 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 about 10 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 about 10 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 about 10 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 about 10 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 about 10 years ago
- File deleted (
01_translate_str.patch)
#9 Updated by Thomas Lange about 10 years ago
- File deleted (
02_translate_str.patch)
#10 Updated by Thomas Lange about 10 years ago
- File deleted (
03_translate_str.patch)
#11 Updated by Thomas Lange about 10 years ago
- File translate_str.patch translate_str.patch added
Updated patch attached.
#12 Updated by John Lindgren about 10 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.