我不是程序员,但我想帮助使用gettext翻译用vala编写的项目(http://live.gnome.org/Vala/Tutorial)。当我不得不使用占位符重新排列句子的某些部分时,我遇到了一个问题。
示例:
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("&", "&") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&") + "</b> " + _("..."), null);
errorBox.show();
list.hide();
albumView.hide();
similarsFetched = false;
}
我需要做什么?
答案 0 :(得分:0)
我还没有使用过vala而我还没有对此进行过测试,看起来你需要更换
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("&", "&") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&") + "</b> " + _("..."), null);
带
string title = lm.media_info.media.title.replace("&", "&");
string artist = lm.media_info.media.artist.replace("&", "&");
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);