当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TranslationFunction.default方法代码示例

本文整理汇总了TypeScript中i18next.TranslationFunction.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TranslationFunction.default方法的具体用法?TypeScript TranslationFunction.default怎么用?TypeScript TranslationFunction.default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在i18next.TranslationFunction的用法示例。


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

示例1: t

 .map(p => (
   (p == null || p === '')
     ? t('Name cannot be empty')
     : (duplicates.includes(p))
       ? t('Name cannot be repeated')
       : ''
 ))
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:7,代码来源:entry-validator.ts

示例2: validateMisc

function validateMisc(playerNames: string[], t: TranslationFunction): string | null {
  if (playerNames.length < 2) {
    return t('At least 2 players is required for a game')
  } else if (playerNames.length > playerUpperLimit) {
    return t('Too many players. Upper limit is {{limit}} players.', {limit: playerUpperLimit})
  }
  return null
}
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:8,代码来源:entry-validator.ts

示例3: t

 const res: IPlayerMap<string | null> = mapValues(names, (name: string) => {
   if (name === '') {
     return t('Name cannot be empty')
   }
   if (duplicates.includes(name)) {
     return t('Name cannot be repeated')
   }
   return null
 })
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:9,代码来源:settings-validator.ts

示例4: t

 (stage: GameStage | null, currentRound: number | null, rounds: number | null, t: TranslationFunction): string => {
   if (stage == null) {
     return ''
   } else if (stage === GameStage.waitingBid || stage === GameStage.waitingWin) {
     return t('Round {{currentRound}} of {{rounds}}', {currentRound, rounds})
   } else if (stage === GameStage.ended) {
     return t('Game over')
   } else {
     return ''
   }
 }
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:11,代码来源:game-title.ts

示例5: validateWin

function validateWin(opts: IStackInput, t: TranslationFunction): IPlayerMap<string> | null {
  if (!opts.win || /* Is empty? */isOk(opts.win)) {
    return null
  }
  const sum: number = sumBy(Object.entries(opts.win), ([, value]) => value)
  if (sum === opts.currentRound) {
    return null
  }
  const msg = sum > opts.currentRound
    ? t('Too many stacks')
    : t('Too less stacks')
  return mapValues(opts.win, () => msg)
}
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:13,代码来源:stack-input-validator.ts

示例6: validateMisc

function validateMisc(names: IPlayerMap<string>, currentRound: number, expectedRounds: number, t: TranslationFunction): string | null {
  const size = Object.keys(names).length
  if (size < 2) {
    return t('At least 2 players is required for a game')
  }
  if (size > playerUpperLimit) {
    return t('Too many players. Upper limit is {{limit}} players.', {limit: playerUpperLimit})
  }
  if (expectedRounds < currentRound) {
    return t('Impossible to continue the game due to too many players')
  }
  return null
}
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:13,代码来源:settings-validator.ts

示例7: validateBid

function validateBid(opts: IStackInput, t: TranslationFunction): IPlayerMap<string> | null {
  if (!opts.bid) {
    return null
  }
  const sum: number = sumBy(Object.entries(opts.bid), ([, value]) => value)
  return sum === opts.currentRound
    ? {[opts.lastPlayerID]: t('Cannot choose that')}
    : null
}
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:9,代码来源:stack-input-validator.ts

示例8: t

 .map(theme => ({
   value: theme,
   label: t(theme)
 }))
开发者ID:Holi0317,项目名称:bridge-calc,代码行数:4,代码来源:theme-sources.ts


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