wxWidgets Debug Alert when | is missing from translation

Anything you think is missing, or needs enhancement, goes here.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by scootergrisen » Wed Sep 06, 2017 1:21 pm

Windows 7 64-bit - Audacity 2.2.0-beta-Sep 1 2017 - .exe-installer

If i write something non-empty without "|" for msgstr in this translation i get the following dialog when using File > Open....

#. i18n-hint: The vertical bars and * are essential here.
#: src/BatchProcessDialog.cpp:265 src/Project.cpp:2842
msgid "All files|*|All supported files|"
msgstr "x"


alert.png
alert.png (11.34 KiB) Viewed 352 times


I see the comment "i18n-hint: The vertical bars and * are essential here." but i dont think a translation should affect the software in such a way.
It would be better for the code to check that the string lives up to the requirements and if not discard it and use the original string.
That way the software will still work no matter what the string have been translated to.
The perhaps a message would be written in the log instead so that the failty translation could be spotted and fixed.
scootergrisen
 
Posts: 52
Joined: Thu Jul 09, 2015 5:45 pm
Operating System: Windows 7

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by steve » Wed Sep 06, 2017 2:01 pm

I agree that's not nice, though it has been like that for at least 8 years!

How would it be for you if it were like this, and what would you suggest as a good " i18n-hint" ?
Code: Select all
   wxString mask = _("All files") + "|*|" + _("All supported files") + wxT("|") +
                   all + wxT("|"); // "all" and "all supported" entries
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45076
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by steve » Wed Sep 06, 2017 2:11 pm

Moved this topic to "Adding features" as I'd like to deal with this at the earliest opportunity. (I can't change this now as the code is currently in freeze other than bug fixes)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45076
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by scootergrisen » Wed Sep 06, 2017 2:34 pm

I dont know what a good code solution would be.

The comment is fine i guess.

Personally i would write the actual character instead of "vertical bars":
#. i18n-hint: | and * are essential here
#. i18n-hint: "|" and "*" are essential here
#. i18n-hint: Characters | and * are essential here

Something like that.

There are other strings with "|" to.
I dont know how many of them causes this alert or other problems.
scootergrisen
 
Posts: 52
Joined: Thu Jul 09, 2015 5:45 pm
Operating System: Windows 7

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by steve » Wed Sep 06, 2017 3:14 pm

scootergrisen wrote:i dont think a translation should affect the software in such a way.

Neither do I.

The code that I suggested in my previous post would give two separate strings for translation:
"All files" and "All supported files"

Does that need a translation hint?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45076
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by scootergrisen » Wed Sep 06, 2017 3:51 pm

I dont think its a problem that the translation is in one string like "All files|*|All supported files|".
There are other strings like that:
Text files (*.txt)|*.txt|All files|*
MIDI file (*.mid)|*.mid|Allegro file (*.gro)|*.gro
MIDI and Allegro files (*.mid;*.midi;*.gro)|*.mid;*.midi;*.gro|MIDI files (*.mid;*.midi)|*.mid;*.midi|Allegro files (*.gro)|*.gro|All files|*
All files|*
Only avformat.dll|*avformat*.dll|Dynamically Linked Libraries (*.dll)|*.dll|All Files|*
Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*
Only libavformat.so|libavformat*.so*|Dynamically Linked Libraries (*.so*)|*.so*|All Files (*)|*
xml files (*.xml;*.XML)|*.xml;*.XML
Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|Text files (*.txt)|*.txt|All files|*
XML files (*.xml)|*.xml|All files|*
Only lame_enc.dll|lame_enc.dll|Dynamically Linked Libraries (*.dll)|*.dll|All Files|*
Only libmp3lame.dylib|libmp3lame.dylib|Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*
Only libmp3lame.so.0|libmp3lame.so.0|Primary Shared Object files (*.so)|*.so|Extended Libraries (*.so*)|*.so*|All Files (*)|*
Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*


I think its okay to keep them like that.
But to test the translated strings before using them so they can't create problems in the software like that dialog.

There are also some strings like:
01000,01000,01000 samples|#


I dont know if they can all cause problems if translated to something without |.
scootergrisen
 
Posts: 52
Joined: Thu Jul 09, 2015 5:45 pm
Operating System: Windows 7

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by steve » Wed Sep 06, 2017 4:32 pm

scootergrisen wrote:But to test the translated strings before using them so they can't create problems in the software like that dialog

It's much easier to just split the string rather than validating the translation text.
You guys that do the translations do a fantastic job and it is extremely rare that a translation causes a fault in the program, but it's better if we can prevent problems from occurring.

The "Assert" is actually a "test", and in the previous version of wxWidgets an Assert would only appear in debug builds. However, in wxWidgets 3.0 there are more debug levels and even release builds will show Asserts if they fire, so we need to take more care that we don't trigger them.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45076
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: wxWidgets Debug Alert when | is missing from translation

Permanent link to this post Posted by scootergrisen » Wed Sep 06, 2017 7:43 pm

I guess it does say "All files" a lot in the strings.
12 times in the strings i posted earlier.
So that would be smarter to just have it translated once and used multiple places.

Also maybe all the "*" and "*.txt" etc. dont need to be in the translation files at all if they are always suppose to be the same.

So this:
Text files (*.txt)|*.txt|All files|*
MIDI file (*.mid)|*.mid|Allegro file (*.gro)|*.gro
MIDI and Allegro files (*.mid;*.midi;*.gro)|*.mid;*.midi;*.gro|MIDI files (*.mid;*.midi)|*.mid;*.midi|Allegro files (*.gro)|*.gro|All files|*
All files|*
Only avformat.dll|*avformat*.dll|Dynamically Linked Libraries (*.dll)|*.dll|All Files|*
Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*
Only libavformat.so|libavformat*.so*|Dynamically Linked Libraries (*.so*)|*.so*|All Files (*)|*
xml files (*.xml;*.XML)|*.xml;*.XML
Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|Text files (*.txt)|*.txt|All files|*
XML files (*.xml)|*.xml|All files|*
Only lame_enc.dll|lame_enc.dll|Dynamically Linked Libraries (*.dll)|*.dll|All Files|*
Only libmp3lame.dylib|libmp3lame.dylib|Dynamic Libraries (*.dylib)|*.dylib|All Files (*)|*
Only libmp3lame.so.0|libmp3lame.so.0|Primary Shared Object files (*.so)|*.so|Extended Libraries (*.so*)|*.so*|All Files (*)|*
Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*


Could become something like this:
All files
Text files
MIDI file
Allegro file
MIDI and Allegro files
MIDI files
Allegro files
Only avformat.dll
*avformat*.dll
Dynamically Linked Libraries
Dynamic Libraries
Only libavformat.so
libavformat*.so*
Dynamically Linked Libraries
xml files
Nyquist scripts
Lisp scripts
Text files
XML files
Only lame_enc.dll
lame_enc.dll
Dynamically Linked Libraries
Only libmp3lame.dylib
Dynamic Libraries
Only libmp3lame.so.0
Primary Shared Object files
Extended Libraries
Nyquist scripts
Lisp scripts


Some are them appear multiple times like "Dynamically Linked Libraries" so that could be translated in just one place.
Also "Dynamic Libraries"
There is both "xml files" with small characters and "XML files" with big. So having only one string for is helps get it consistent.
"Nyquist scripts" and "Lisp scripts" also appread twice.
Perhaps filnames like "libavformat.so" and "lame_enc.dll" should also not be in the translations files if they are always suppose to be the same.
scootergrisen
 
Posts: 52
Joined: Thu Jul 09, 2015 5:45 pm
Operating System: Windows 7


Return to Adding Features to Audacity



Who is online

Users browsing this forum: No registered users and 1 guest