Files
Jyotisha/frontend/src/lib/chart-view-labels.ts
T

223 lines
6.9 KiB
TypeScript

export const PLANET_ORDER = [
"Sun",
"Moon",
"Mars",
"Mercury",
"Jupiter",
"Venus",
"Saturn",
"Rahu",
"Ketu",
] as const;
export type PlanetName = (typeof PLANET_ORDER)[number];
export const PLANET_ZH: Record<PlanetName, string> = {
Sun: "太阳",
Moon: "月亮",
Mars: "火星",
Mercury: "水星",
Jupiter: "木星",
Venus: "金星",
Saturn: "土星",
Rahu: "罗睺",
Ketu: "计都",
};
export const SIGN_ORDER = [
"Aries",
"Taurus",
"Gemini",
"Cancer",
"Leo",
"Virgo",
"Libra",
"Scorpio",
"Sagittarius",
"Capricorn",
"Aquarius",
"Pisces",
] as const;
export type SignName = (typeof SIGN_ORDER)[number];
export const SIGN_ZH: Record<SignName, string> = {
Aries: "白羊",
Taurus: "金牛",
Gemini: "双子",
Cancer: "巨蟹",
Leo: "狮子",
Virgo: "处女",
Libra: "天秤",
Scorpio: "天蝎",
Sagittarius: "射手",
Capricorn: "摩羯",
Aquarius: "水瓶",
Pisces: "双鱼",
};
/** Every divisional chart the page asks `/api/varga_full` for, D1 included. */
export const VARGA_CHIP_ORDER = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 20, 24, 27, 30, 40, 45, 60,
] as const;
/**
* The 23 chart types of the 星盘 tab, in the order the strip and the
* 「星盘类型」sheet show them (TASK-chart-types D2). `MOON` is the D1 counted
* from the Moon's sign, `BHAVA` the Sripati Bhava Chalit, `TRANSIT` today's
* sky placed in the natal houses.
*/
export const CHART_TYPE_ORDER = [
"D1", "D9", "MOON", "BHAVA", "TRANSIT",
"D2", "D3", "D4", "D5", "D6", "D7", "D8", "D10", "D11", "D12",
"D16", "D20", "D24", "D27", "D30", "D40", "D45", "D60",
] as const;
export type ChartTypeId = (typeof CHART_TYPE_ORDER)[number];
/** Label on the strip: short, so the row stays one line at 375px. */
export const CHART_TYPE_STRIP_LABEL: Partial<Record<ChartTypeId, string>> = {
D1: "本命",
MOON: "月亮",
BHAVA: "Bhava",
TRANSIT: "行运",
};
/** Big label and one-line use in the sheet, for the types that are not D-numbers. */
export const CHART_TYPE_SHEET_COPY: Partial<Record<ChartTypeId, { label: string; use: string }>> = {
D1: { label: "本命", use: "D1" },
MOON: { label: "月亮盘", use: "以月亮为第 1 宫" },
BHAVA: { label: "Bhava", use: "不等宫" },
TRANSIT: { label: "行运", use: "今天" },
};
/**
* Divisional charts fine enough that a two-to-three minute birth-time error can
* move a body a whole sign (D40 0.75°, D45 0.67°, D60 0.5° per part).
*/
export const BIRTH_TIME_SENSITIVE_VARGAS: ReadonlySet<string> = new Set(["D40", "D45", "D60"]);
export function isChartTypeId(value: string): value is ChartTypeId {
return (CHART_TYPE_ORDER as readonly string[]).includes(value);
}
export const VIMSHOTTARI_ORDER = [
"Ketu",
"Venus",
"Sun",
"Moon",
"Mars",
"Rahu",
"Jupiter",
"Saturn",
"Mercury",
] as const;
export const VIMSHOTTARI_YEARS: Record<(typeof VIMSHOTTARI_ORDER)[number], number> = {
Ketu: 7,
Venus: 20,
Sun: 6,
Moon: 10,
Mars: 7,
Rahu: 18,
Jupiter: 16,
Saturn: 19,
Mercury: 17,
};
export const WESTERN_BODY_ZH: Record<string, string> = {
sun: "太阳",
moon: "月亮",
mercury: "水星",
venus: "金星",
mars: "火星",
jupiter: "木星",
saturn: "土星",
uranus: "天王",
neptune: "海王",
pluto: "冥王",
true_node: "北交",
ascendant: "上升",
mc: "中天",
};
export const ASPECT_ZH: Record<string, string> = {
conjunction: "合相",
sextile: "六分相",
square: "刑相",
trine: "三分相",
opposition: "对相",
};
export const ELEMENT_ZH: Record<string, string> = {
fire: "火",
earth: "土",
air: "风",
water: "水",
};
export const MODE_ZH: Record<string, string> = {
cardinal: "基本",
fixed: "固定",
mutable: "变动",
};
export const COORDINATE_BOUNDARY = {
vedic: "这是恒星黄道,岁差用你资料里选的那一套。它和西洋回归黄道不是同一套坐标,不能换算,也不能叠成双重印证。",
western: "这是回归黄道,宫位用 Placidus。它和印度盘的恒星黄经不是同一套,不能换算,也不能叠成双重印证。",
} as const;
export const DASHA_DUAL_TRACK_NOTE = "只有两条同时指向同一段时间才算证据,单轨命中要降一级来看。";
export const ANTARDASHA_DERIVED_NOTE = "分运按标准比例从大运边界推出,不是引擎单独返回的字段。";
export const CHARA_ANTARDASHA_DATE_NOTE = "分运时长来自引擎的十二等分;起止日期按大运边界推算,不是引擎单独返回的日历字段。";
export const CHARA_ZERO_YEAR_LABEL = "0 年";
export const CHARA_ZERO_YEAR_NOTE = "本段时长为 0,不展开";
export const WESTERN_UNAVAILABLE_COPY = "西洋盘这一栏要等回归黄道端点上线。现在还没有,先空着——不会拿印度盘的度数改写成回归黄道。";
export const CHART_VIEW_CLIENT_TIMEOUT_MS = 25_000;
export const CHART_VIEW_COPY = {
timedOut: "这张盘等了太久没有回来,再打开一次试试。",
busy: "算盘的服务正忙,稍等几秒再打开就好。",
unavailable: "这张盘算不出来,我们已经记录下来了。",
waitingChart: "这一张盘还没拿到。",
waitingLayer: "这一栏还没拿到。",
waitingVarga: "这一分盘还没拿到。",
chartTypeSheetTitle: "星盘类型",
chartTypeMenu: "全部盘型",
chartTypeSheetClose: "关闭星盘类型",
bhavaNote: "宫制 Sripati:用出生时刻的上升和天顶把四个象限各分三份,行星按宫界重新归宫。星座度数和本命盘相同。",
transitNote: "以本命上升为第 1 宫,放的是这一天中午的行星位置。岁差和交点与本命相同。",
precisionHint: "这张盘每格不到一度,出生时间差两三分钟就可能换一格。先做生时校正再看,会更稳。",
unauthenticated: "请先登录后再看星盘。",
incomplete: "还没有可用来排盘的出生资料。把日期、时间和地点填进星盘资料后,打开就能看见盘。",
profileEntryTitle: "还没有星盘资料",
profileEntryAction: "去填写出生资料",
profileQueryError: "星盘资料这会儿读不出来,我们已经记录下来了。",
adoptedIncomplete: "已采用的出生时间缺了排盘要用的时区,这张盘先不能算。我们已经记录下来了。",
timezoneFailure: "出生地的时区没有对上,这张盘先不能算。我们已经记录下来了。",
schemaFailure: "星盘结果的格式对不上,我们已经记录下来了。",
rateLimited: "刚才打开得太勤,稍等再试。",
} as const;
export function planetZh(name: string): string {
return PLANET_ZH[name as PlanetName] ?? name;
}
export function signZh(sign: string): string {
return SIGN_ZH[sign as SignName] ?? sign;
}
export function isSignName(value: string): value is SignName {
return (SIGN_ORDER as readonly string[]).includes(value);
}
export function isPlanetName(value: string): value is PlanetName {
return (PLANET_ORDER as readonly string[]).includes(value);
}