0

I'm not a programmer, but I want to help translating a project written in vala (http://live.gnome.org/Vala/Tutorial) using gettext. I encountered a problem when I had to rearrange parts of a sentence using placeholders.

Example:

public void show_retrieving_similars() {
    if(hint != ViewWrapper.Hint.SIMILAR || lm.media_info.media == null)
        return;

    errorBox.show_icon = false;
    errorBox.setWarning("<span weight=\"bold\" size=\"larger\">" + _("Loading similar songs") + "</span>\n\n" + _("BeatBox is loading songs similar to") + " <b>" + lm.media_info.media.title.replace("&", "&amp;") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&amp;") + "</b> " + _("..."), null);
    errorBox.show();
    list.hide();
    albumView.hide();
    similarsFetched = false;
}

What do I need to do?

1
  • You should probably report this as a bug to the project you are translating.
    – ptomato
    Feb 1, 2012 at 9:00

1 Answer 1

0

I haven't used vala and I haven't tested this, it looks like you need to replace

errorBox.setWarning("<span weight=\"bold\" size=\"larger\">" + _("Loading similar songs") + "</span>\n\n" + _("BeatBox is loading songs similar to") + " <b>" + lm.media_info.media.title.replace("&", "&amp;") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&amp;") + "</b> " + _("..."), null);

with

string title = lm.media_info.media.title.replace("&", "&amp;");
string artist = lm.media_info.media.artist.replace("&", "&amp;");
errorBox.setWarning(@"<span weight=\"bold\" size=\"larger\">Loading similar songs</span>\n\n BeatBox is loading songs similar to<b> $title </b>by<b> $artist </b>...", null);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.