storebound/apps/desktop/src/card/text.ts

111 lines
3.8 KiB
TypeScript

// The tray card's words in every language the app has (en, tr; same keys, tr typed against en). Kept apart from the
// main catalogs so the card bundle stays small.
export const en = {
title: 'Store status',
rejected: 'Rejected',
rejections: 'Needs you',
moving: 'Releases on the move',
review: 'In review',
rollout: 'Rolling out',
rolloutPct: 'Rolling out {pct}%',
approved: 'Waiting for release',
halted: 'Rollout halted',
reviews: 'Reviews',
recent: '{n} new in the last 7 days',
recentNone: 'No new reviews in the last 7 days',
health: 'Crash and ANR alerts',
crash: 'Crash rate over the bad behavior threshold',
anr: 'ANR rate over the bad behavior threshold',
crashAnr: 'Crash and ANR rates over the bad behavior threshold',
calm: 'All quiet: nothing in review, rolling out or waiting on you.',
noData: 'No store read yet. Refresh reads every app.',
lastRead: 'Read {ago}',
never: 'never',
justNow: 'just now',
min: '{n} min ago',
hour: '{n} h ago',
day: '{n} d ago',
refresh: 'Refresh',
refreshing: 'Reading…',
openMain: 'Open storebound',
build: 'storebound {version} · {channel} channel',
chStable: 'stable',
chDev: 'dev',
chBeta: 'beta',
more: 'More',
mute: 'Mute notifications for 1 hour',
unmute: 'Unmute notifications',
muted: 'Muted',
quit: 'Quit storebound',
openApp: 'Open {name}',
asc: 'App Store Connect',
play: 'Play Console',
appStore: 'App Store',
playStore: 'Play',
stars: '{n} of 5 stars',
};
export type CardKey = keyof typeof en;
export const tr: Record<CardKey, string> = {
title: 'Mağaza durumu',
rejected: 'Reddedildi',
rejections: 'Seni bekliyor',
moving: 'İlerleyen sürümler',
review: 'İncelemede',
rollout: 'Yayılıyor',
rolloutPct: '%{pct} yayılıyor',
approved: 'Yayın bekliyor',
halted: 'Yayılım durduruldu',
reviews: 'Yorumlar',
recent: 'Son 7 günde {n} yeni',
recentNone: 'Son 7 günde yeni yorum yok',
health: 'Çökme ve ANR uyarıları',
crash: 'Çökme oranı kötü davranış eşiğinin üstünde',
anr: 'ANR oranı kötü davranış eşiğinin üstünde',
crashAnr: 'Çökme ve ANR oranları kötü davranış eşiğinin üstünde',
calm: 'Her şey sakin: incelemede, yayılan ya da seni bekleyen bir şey yok.',
noData: 'Henüz mağaza okunmadı. Yenile her uygulamayı okur.',
lastRead: '{ago} okundu',
never: 'hiç',
justNow: 'az önce',
min: '{n} dk önce',
hour: '{n} sa önce',
day: '{n} gün önce',
refresh: 'Yenile',
refreshing: 'Okunuyor…',
openMain: 'storebound\'u aç',
build: 'storebound {version} · {channel} kanalı',
chStable: 'kararlı',
chDev: 'geliştirme',
chBeta: 'beta',
more: 'Diğer',
mute: 'Bildirimleri 1 saat sustur',
unmute: 'Bildirimleri aç',
muted: 'Sessiz',
quit: 'storebound\'dan çık',
openApp: '{name} uygulamasını aç',
asc: 'App Store Connect',
play: 'Play Console',
appStore: 'App Store',
playStore: 'Play',
stars: '5 üzerinden {n} yıldız',
};
export const CARD_TEXT = { en, tr } as const;
export type CardLang = keyof typeof CARD_TEXT;
export function cardT(lang: CardLang, key: CardKey, vars?: Record<string, string | number>): string {
const s = CARD_TEXT[lang][key] ?? en[key];
return vars ? s.replace(/\{(\w+)\}/g, (m, k: string) => (vars[k] === undefined ? m : String(vars[k]))) : s;
}
/** "3 min ago" style age of the last read. */
export function ago(lang: CardLang, at: string | null, now: number): string {
if (!at) return cardT(lang, 'never');
const m = Math.floor((now - Date.parse(at)) / 60_000);
if (!Number.isFinite(m)) return cardT(lang, 'never');
if (m < 1) return cardT(lang, 'justNow');
if (m < 60) return cardT(lang, 'min', { n: m });
if (m < 48 * 60) return cardT(lang, 'hour', { n: Math.floor(m / 60) });
return cardT(lang, 'day', { n: Math.floor(m / 1440) });
}