Translation: How to handle different position of object in sentences?

Asked by 982c80311320c1b

Example:

"BeatBox could not find songs similar to" + " <b>" + lm.media_info.media.title.replace("&", "&amp;") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&amp;") + "</b>.\n"

In German, it would need to be:

"BeatBox konnte keine Titel finden, die" + " <b>" + lm.media_info.media.title.replace("&", "&amp;") + "</b> von <b>" + lm.media_info.media.artist.replace("&", "&amp;") + "ähnlich sind</b>.\n"

Is it possible to translate the whole sentence using placeholders?

Question information

Language:
English Edit question
Status:
Solved
For:
BeatBox Edit question
Assignee:
No assignee Edit question
Solved by:
982c80311320c1b
Solved:
Last query:
Last reply:
Revision history for this message
Victor Martinez (victored) said :
#1
Revision history for this message
982c80311320c1b (alexander-wilms) said :
#2

Thanks, but I still do not know how I would need to change the code, since this was about printf. Or is somthing similar possible for errorBox.setWarning etc?

Revision history for this message
982c80311320c1b (alexander-wilms) said :
#3

I managed to use placeholders:

    if(medias.size < 10) { // say we could not find similar medias
     errorBox.show_icon = true;
                     string satzii = _("BeatBox (konnte) could not find songs similar to %1$s by %2$s.\n").printf ("<b>" + lm.media_info.media.title.replace("&", "&amp;") + "</b>", "<b>" + lm.media_info.media.artist.replace("&", "&amp;") + "</b>");
     errorBox.setWarning("<span weight=\"bold\" size=\"larger\">" + _("No similar songs found") + "\n</span>\n" + satzii + _("Make sure all song info is correct and you are connected to the Internet.\nSome songs may not have matches."), Justification.LEFT);
     errorBox.show_all();
     list.hide();
     albumView.hide();
     stdout.printf("2\n");

     in_update = false;
     return;
    }
But the translation doesn't show up in BeatBox.
I already had such an issue with the SmartPlaylistEditor, but maybe could tell me what would need to be done.

Revision history for this message
982c80311320c1b (alexander-wilms) said :
#4