• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript translate.pgettext函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中translate.pgettext函数的典型用法代码示例。如果您正苦于以下问题:TypeScript pgettext函数的具体用法?TypeScript pgettext怎么用?TypeScript pgettext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pgettext函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: shortShortTimeControl

export function shortShortTimeControl(time_control) { /* {{{ */
    if (typeof(time_control) !== "object") {
        return "~" + shortDurationString(time_control);
    }

    switch (time_control.system || time_control.time_control) {
        case "simple":
            return interpolate(pgettext("Simple time: <time>/move", "%s/move"), [shortDurationString(time_control.per_move).toLowerCase()]);
        case "fischer":
            return interpolate(pgettext("Fischer time", "%s+%s up to %s"), [
                                    shortDurationString(time_control.initial_time).toLowerCase(),
                                    shortDurationString(time_control.time_increment).toLowerCase(),
                                    shortDurationString(time_control.max_time).toLowerCase()
                                ]);
        case "byoyomi":
            return interpolate(pgettext("Japanese Byo-Yomi", "%s+%sx%s"), [
                                    shortDurationString(time_control.main_time).toLowerCase(),
                                    time_control.periods,
                                    shortDurationString(time_control.period_time).toLowerCase().trim()
                                ]);
        case "canadian":
            return interpolate(pgettext("Canadian Byo-Yomi", "%s+%s/%s"), [
                                    shortDurationString(time_control.main_time).toLowerCase(),
                                    shortDurationString(time_control.period_time).toLowerCase(),
                                    time_control.stones_per_period
                                ]);
        case "absolute":
            return shortDurationString(time_control.total_time).toLowerCase();
        case "none":
            return _("None");
        default:
            return "[error: " + (time_control.system || time_control.time_control) + "]";
    }
}  /* }}} */
开发者ID:PowerOlive,项目名称:online-go.com,代码行数:34,代码来源:util.ts


示例2: shortDurationString

export function shortDurationString(seconds) { /* {{{ */
    let weeks = Math.floor(seconds / (86400 * 7)); seconds -= weeks * 86400 * 7;
    let days = Math.floor(seconds / 86400); seconds -= days * 86400;
    let hours = Math.floor(seconds / 3600); seconds -= hours * 3600;
    let minutes = Math.floor(seconds / 60); seconds -= minutes * 60;
    return "" +
        (weeks ? " " + interpolate(pgettext("Short time (weeks)", "%swk"), [weeks]) : "") +
        (days ? " " + interpolate(pgettext("Short time (days)", "%sd"), [days]) : "") +
        (hours ? " " + interpolate(pgettext("Short time (hours)", "%sh"), [hours]) : "") +
        (minutes ? " " + interpolate(pgettext("Short time (minutes)", "%sm"), [minutes]) : "") +
        (seconds ? " " + interpolate(pgettext("Short time (seconds)", "%ss"), [seconds]) : "");
} /* }}} */
开发者ID:PowerOlive,项目名称:online-go.com,代码行数:12,代码来源:util.ts


示例3: getOutcomeTranslation

export function getOutcomeTranslation(outcome:string) { /* {{{ */
    /* Note: for the case statements, don't simply do `pgettext("Game outcome", outcome)`,
     * the system to parse out strings to translate needs the text. */
    switch (outcome) {
        case 'resign':
        case 'r':
        case 'Resignation':
            return pgettext("Game outcome", 'Resignation');

        case 'Stone Removal Timeout':
            return pgettext("Game outcome", 'Stone Removal Timeout');
        case 'Timeout':
            return pgettext("Game outcome", 'Timeout');
        case 'Cancellation':
            return pgettext("Game outcome", 'Cancellation');
        case 'Disqualification':
            return pgettext("Game outcome", 'Disqualification');
        case 'Moderator Decision':
            return pgettext("Game outcome", 'Moderator Decision');
        case 'Abandonment':
            return pgettext("Game outcome", 'Abandonment');
    }

    if (/[0-9.]+/.test(outcome)) {
        let num = outcome.match(/([0-9.]+)/)[1];
        return interpolate(pgettext("Game outcome", "{{number}} points"), {"number": num});
    }

    return outcome;
} /* }}} */
开发者ID:PowerOlive,项目名称:online-go.com,代码行数:30,代码来源:misc.ts


示例4: rankString

export function rankString(r) {
    if (typeof(r) === "object") {
        let ranking = "ranking" in r ? r.ranking : r.rank;
        if (r.pro || r.professional) {
            return interpolate(pgettext("Pro", "%sp"), [((ranking - 36))]);
        }
        r = ranking;
    }
    if (r > 900) {
        return interpolate(pgettext("Pro", "%sp"), [(((r - 1000) - 36))]);
    }
    if (r < -900) {
        return "?";
    }

    if (r < 30) {
        return interpolate(pgettext("Kyu", "%sk"), [(30 - r)]);
    }
    return interpolate(pgettext("Dan", "%sd"), [((r - 30) + 1)]);
}
开发者ID:PowerOlive,项目名称:online-go.com,代码行数:20,代码来源:rank_utils.ts


示例5: timeControlSystemText

export function timeControlSystemText(system) { /* {{{ */
    switch (system) {
        case "simple"   : return pgettext("time control system", "simple");
        case "fischer"  : return pgettext("time control system", "fischer");
        case "byoyomi"  : return pgettext("time control system", "byo-yomi");
        case "canadian" : return pgettext("time control system", "canadian byo-yomi");
        case "absolute" : return pgettext("time control system", "absolute");
        case "none"     : return pgettext("time control system", "none");
        default    : return "[error]";
    }
} /* }}} */
开发者ID:PowerOlive,项目名称:online-go.com,代码行数:11,代码来源:util.ts



注:本文中的translate.pgettext函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript trash.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript translate.interpolate函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap