How to use the @lingui/macro.t function in @lingui/macro

To help you get started, we鈥檝e selected a few @lingui/macro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xivanalysis / xivanalysis / src / parser / core / modules / Gauge / Gauge.tsx View on Github external
import {t} from '@lingui/macro'
import TimeLineChart from 'components/ui/TimeLineChart'
import {DeathEvent} from 'fflogs'
import Module from 'parser/core/Module'
import React from 'react'
import {isDefined} from 'utilities'
import {AbstractGauge} from './AbstractGauge'
import {TimerGauge} from './TimerGauge'

export class Gauge extends Module {
	static handle = 'gauge'
	static title = t('core.gauge.title')`Gauge`

	private gauges: AbstractGauge[] = []

	protected init() {
		this.addHook('death', {to: 'player'}, this.onDeath)
	}

	/** Add & initialise a gauge implementation to be tracked as part of the core gauge handling. */
	add(gauge: T) {
		gauge.setParser(this.parser)

		// TODO: Work out how to remove this. Probably also the parser, too.
		if (gauge instanceof TimerGauge) {
			gauge.setAddTimestampHook(this.addTimestampHook.bind(this))
			gauge.setRemoveTimestampHook(this.removeTimestampHook.bind(this))
		}
github xivanalysis / xivanalysis / src / parser / jobs / sch / index.js View on Github external
import {t} from '@lingui/macro'
import {Trans} from '@lingui/react'
import React from 'react'
import {Icon, Message} from 'semantic-ui-react'

import TransMarkdown from 'components/ui/TransMarkdown'
import CONTRIBUTORS, {ROLES} from 'data/CONTRIBUTORS'
import {Meta} from 'parser/core/Meta'

const description = t('sch.about.description')`
This analyser aims to identify some of the low-hanging fruit that could be used to improve your SCH gameplay, as well as give a deeper insight into what happened during an encounter.

If you would like to learn more about SCH, check the guides over at [The Balance](https://thebalanceffxiv.com/), and have a chat in the #sch_questions channel.
`

export default new Meta({
	modules: () => import('./modules' /* webpackChunkName: "jobs-sch" */),

	Description: () => <>
		
		
			
			
				While the analysis below should be reasonably accurate, this system <em>is</em> still in development, and may get a little mixed up sometimes. If you notice any issues, or have any concerns, please drop by our Discord channel!
github xivanalysis / xivanalysis / src / parser / jobs / smn / modules / DoTs.js View on Github external
// Can never be too careful :blobsweat:
const STATUS_DURATION = {
	[STATUSES.BIO_III.id]: 30000,
	[STATUSES.MIASMA_III.id]: 30000,
}

// In ms
const CLIPPING_SEVERITY = {
	1000: SEVERITY.MINOR,
	10000: SEVERITY.MEDIUM,
	30000: SEVERITY.MAJOR,
}

export default class DoTs extends Module {
	static handle = 'dots'
	static title = t('smn.dots.title')`DoTs`
	static dependencies = [
		'checklist',
		'enemies',
		'gauge',
		'invuln',
		'suggestions',
	]

	_lastApplication = {}
	_clip = {
		[STATUSES.BIO_III.id]: 0,
		[STATUSES.MIASMA_III.id]: 0,
	}
	_application = {
		[STATUSES.BIO_III.id]: [],
		[STATUSES.MIASMA_III.id]: [],
github xivanalysis / xivanalysis / src / data / JOBS.ts View on Github external
colour: string
	role: Role['id']
}

// Yeah I know there's lots of repetition but they're all different apis and endpoints and shit and I don't wanna pull it apart later to fix a desync
const JOBS = {
	// Tank
	PALADIN: {
		name: t('game.job.paladin')`Paladin`,
		logType: ActorType.PALADIN,
		icon: 'pld',
		colour: '#a8d2e6',
		role: ROLES.TANK.id,
	},
	WARRIOR: {
		name: t('game.job.warrior')`Warrior`,
		logType: ActorType.WARRIOR,
		icon: 'war',
		colour: '#cf2621',
		role: ROLES.TANK.id,
	},
	DARK_KNIGHT: {
		name: t('game.job.dark-knight')`Dark Knight`,
		logType: ActorType.DARK_KNIGHT,
		icon: 'drk',
		colour: '#d126cc',
		role: ROLES.TANK.id,
	},
	GUNBREAKER: {
		name: t('game.job.gunbreaker')`Gunbreaker`,
		logType: ActorType.GUNBREAKER,
		icon: 'gnb',
github xivanalysis / xivanalysis / src / data / JOBS.ts View on Github external
const roleData = {
	TANK: {
		id: 1,
		name: t('game.roles.tank')`Tank`,
		colour: colors.tank,
	},

	HEALER: {
		id: 2,
		name: t('game.roles.healer')`Healer`,
		colour: colors.healer,
	},

	MELEE: {
		id: 3,
		name: t('game.roles.melee-dps')`Melee DPS`,
		colour: colors.dps,
	},

	PHYSICAL_RANGED: {
		id: 4,
		name: t('game.roles.physical-ranged-dps')`Physical Ranged DPS`,
		colour: colors.dps,
	},

	MAGICAL_RANGED: {
		id: 5,
		name: t('game.roles.magical-ranged-dps')`Magical Ranged DPS`,
		colour: colors.dps,
	},

	// Not really roles but w/e
github xivanalysis / xivanalysis / src / data / JOBS.ts View on Github external
export const ROLES = roleData as Record

export interface Job {
	name: MessageDescriptor
	logType: ActorType
	icon: string
	colour: string
	role: Role['id']
}

// Yeah I know there's lots of repetition but they're all different apis and endpoints and shit and I don't wanna pull it apart later to fix a desync
const JOBS = {
	// Tank
	PALADIN: {
		name: t('game.job.paladin')`Paladin`,
		logType: ActorType.PALADIN,
		icon: 'pld',
		colour: '#a8d2e6',
		role: ROLES.TANK.id,
	},
	WARRIOR: {
		name: t('game.job.warrior')`Warrior`,
		logType: ActorType.WARRIOR,
		icon: 'war',
		colour: '#cf2621',
		role: ROLES.TANK.id,
	},
	DARK_KNIGHT: {
		name: t('game.job.dark-knight')`Dark Knight`,
		logType: ActorType.DARK_KNIGHT,
		icon: 'drk',
github xivanalysis / xivanalysis / src / parser / jobs / dnc / modules / FeatherGauge.tsx View on Github external
ACTIONS.FOUNTAINFALL.id,
	ACTIONS.RISING_WINDMILL.id,
	ACTIONS.BLOODSHOWER.id,
]

const FEATHER_CONSUMERS = [
	ACTIONS.FAN_DANCE.id,
	ACTIONS.FAN_DANCE_II.id,
]

const FEATHER_GENERATION_CHANCE = .5
const MAX_FEATHERS = 4

export default class FeatherGauge extends Module {
	static handle = 'feathergauge'
	static title = t('dnc.feather-gauge.title')`Feather Gauge`

	@dependency private suggestions!: Suggestions

	private feathersConsumed = 0
	private avgGenerated = 0
	private history: GaugeGraphEntry[] = [{t: 0, y: 0, isGenerator: false}]
	private currentFeathers = 0
	private featherOvercap = 0

	protected init() {
		this.addHook('aoedamage', {by: 'player', abilityId: FEATHER_GENERATORS}, this.onCastGenerator)
		this.addHook('cast', {by: 'player', abilityId: FEATHER_CONSUMERS}, this.onConsumeFeather)
		this.addHook('death', {to: 'player'}, this.onDeath)
		this.addHook('complete', this.onComplete)
	}
github xivanalysis / xivanalysis / src / parser / core / modules / AoEUsages.tsx View on Github external
}

/**
 * This module checks for usages of AoE skills that have single target alternatives,
 * such as BLMs Xenoglossy or NINs Hellfrog Medium, to ensure they hit the minimum
 * number of targets.  It should not be used to check skills that can hit AoE but do
 * not have alternatives, such as DRGs Dragonfire Dive or SMNs Deathflare, as it is
 * correct to use those skills on single targets.
 *
 * For the AoE combos of melee DPS and Tanks, define a trackedAbility with the first
 * abilities of the AoE and single target combos.  This is to provide leeway to finishing
 * AoE combos when the number of targets may drop below the minimum during the combo.
 */
export abstract class AoEUsages extends Module {
	static handle = 'aoeusages'
	static title = t('core.aoeusages.title')`Incorrect AoE Ability Usage`

	@dependency private suggestions!: Suggestions

	/**
	 * Implementing modules MUST define the icon to be used for the suggestion.
	 */
	abstract suggestionIcon: string
	/**
	 * Implementing modules MUST define the abilities that are to be monitored.
	 */
	abstract trackedAbilities: AoeAbility[]

	/**
	 * Implementing modules MAY override the severity tiers for incorrect AoE usages.
	 */
	protected severity: SeverityTiers = {
github xivanalysis / xivanalysis / src / parser / jobs / mnk / modules / InternalRelease.js View on Github external
import ACTIONS from 'data/ACTIONS'
import STATUSES from 'data/STATUSES'
import Module from 'parser/core/Module'
import {Suggestion, SEVERITY} from 'parser/core/modules/Suggestions'

import DISPLAY_ORDER from './DISPLAY_ORDER'

const IR_DURATION = STATUSES.INTERNAL_RELEASE.duration * 1000

export default class InternalRelease extends Module {
	static handle = 'internalrelease'
	static dependencies = [
		'suggestions',
	]

	static title = t('mnk.ir.title')`Internal Release`
	static displayOrder = DISPLAY_ORDER.INTERNAL_RELEASE

	_active = false
	_history = []
	_release = {casts: []}
	_rushing = false

	_badElixirs = 0
	_badHowlings = 0

	constructor(...args) {
		super(...args)
		this.addHook('cast', {by: 'player'}, this._onCast)
		this.addHook('removebuff', {by: 'player', abilityId: STATUSES.INTERNAL_RELEASE.id}, this._onDrop)
		this.addHook('complete', this._onComplete)
	}

@lingui/macro

Macro for generating messages in ICU MessageFormat syntax

MIT
Latest version published 11 days ago

Package Health Score

98 / 100
Full package analysis