【问题标题】:How to use gettext placeholders?如何使用 gettext 占位符?
【发布时间】:2012-02-22 08:31:18
【问题描述】:

我不是程序员,但我想帮助翻译一个使用 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("&", "&amp;") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&amp;") + "</b> " + _("..."), null);
    errorBox.show();
    list.hide();
    albumView.hide();
    similarsFetched = false;
}

我需要做什么?

【问题讨论】:

  • 您应该将此作为错误报告给您正在翻译的项目。

标签: localization internationalization translation gettext vala


【解决方案1】:

我没用过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("&", "&amp;") + "</b> by <b>" + lm.media_info.media.artist.replace("&", "&amp;") + "</b> " + _("..."), null);

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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-05
    • 1970-01-01
    • 2017-06-20
    • 2014-05-20
    • 2018-10-13
    • 2014-05-21
    • 1970-01-01
    相关资源
    最近更新 更多