Skip to content

Commit

Permalink
Merge pull request #34 from SylarLong/v1.2.2
Browse files Browse the repository at this point in the history
#33 optimize Horoscope
  • Loading branch information
SylarLong authored Sep 7, 2023
2 parents d06874a + 0402ff7 commit b39dc30
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 2 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
- 🛠️ 修复(fix)
- 🧹 琐事(Chore)

## v1.2.2

- ✨ 改进(enhancement)

🇨🇳

- 给 Horoscope 添加 name 字段
- 给 name 字段添加国际化翻译

🇺🇸

- add `name` field to `Horoscope`
- add translation for `name`

## v1.2.1

- 🪄 功能(feature)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iztro",
"version": "1.2.1",
"version": "1.2.2",
"description": "轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。A lightweight kit to astrolabe generator of The Purple Star Astrology (Zi Wei Dou Shu). The Purple Star Astrology(Zi Wei Dou Shu) is a Chinese ancient astrology. You're able to get your horoscope and personality from the astrolabe",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
8 changes: 7 additions & 1 deletion src/astro/FunctionalAstrolabe.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getHeavenlyStemAndEarthlyBranchBySolarDate, normalizeSolarDateStr, solar2lunar } from '../calendar';
import { EARTHLY_BRANCHES } from '../data';
import { Astrolabe, Horoscope } from '../data/types';
import { EarthlyBranchKey, EarthlyBranchName, HeavenlyStemName, kot, PalaceName, StarKey, StarName } from '../i18n';
import { EarthlyBranchKey, EarthlyBranchName, HeavenlyStemName, kot, PalaceName, StarKey, StarName, t } from '../i18n';
import { getHoroscopeStar } from '../star';
import { IFunctionalStar } from '../star/FunctionalStar';
import { fixEarthlyBranchIndex, fixIndex, getMutagensByHeavenlyStem, timeToIndex } from '../utils';
Expand Down Expand Up @@ -103,6 +103,7 @@ const _getHoroscopeBySolarDate = (
lunarDate: _date.toString(true),
decadal: {
index: decadalIndex,
name: t('decadal'),
heavenlyStem: heavenlyStemOfDecade,
earthlyBranch: earthlyBranchOfDecade,
palaceNames: getPalaceNames(decadalIndex),
Expand All @@ -112,9 +113,11 @@ const _getHoroscopeBySolarDate = (
age: {
index: ageIndex,
nominalAge,
name: t('turn'),
},
yearly: {
index: yearlyIndex,
name: t('yearly'),
heavenlyStem: yearly[0],
earthlyBranch: yearly[1],
palaceNames: getPalaceNames(yearlyIndex),
Expand All @@ -123,20 +126,23 @@ const _getHoroscopeBySolarDate = (
},
monthly: {
index: monthlyIndex,
name: t('monthly'),
heavenlyStem: monthly[0],
earthlyBranch: monthly[1],
palaceNames: getPalaceNames(monthlyIndex),
mutagen: getMutagensByHeavenlyStem(monthly[0]),
},
daily: {
index: dailyIndex,
name: t('daily'),
heavenlyStem: daily[0],
earthlyBranch: daily[1],
palaceNames: getPalaceNames(dailyIndex),
mutagen: getMutagensByHeavenlyStem(daily[0]),
},
hourly: {
index: hourlyIndex,
name: t('hourly'),
heavenlyStem: hourly[0],
earthlyBranch: hourly[1],
palaceNames: getPalaceNames(hourlyIndex),
Expand Down
4 changes: 4 additions & 0 deletions src/data/types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { Star } from './star';
export type HoroscopeItem = {
/** 所在宫位的索引 */
index: number;
/** 运限名称 */
name: string;
/** 该运限天干 */
heavenlyStem: HeavenlyStemName;
/** 该运限地支 */
Expand Down Expand Up @@ -76,6 +78,8 @@ export type Horoscope = {
index: number;
/** 虚岁 */
nominalAge: number;
/** 名称 */
name: string;
};
/** 流年 */
yearly: HoroscopeItem;
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/en-US/common.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"decadal": "decadal",
"yearly": "yearly",
"monthly": "monthly",
"daily": "daily",
"hourly": "hourly",
"turn": "turn",
"rat": "rat",
"ox": "ox",
"tiger": "tiger",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/ja-JP/common.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"decadal": "大限",
"yearly": "流年",
"monthly": "流月",
"daily": "流日",
"hourly": "流時",
"turn": "小限",
"rat": "",
"ox": "",
"tiger": "",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/ko-KR/common.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"decadal": "대한",
"yearly": "유년",
"monthly": "유월",
"daily": "유일",
"hourly": "유시",
"turn": "소한",
"rat": "",
"ox": "",
"tiger": "호랑이",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/zh-CN/common.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"decadal": "大限",
"yearly": "流年",
"monthly": "流月",
"daily": "流日",
"hourly": "流时",
"turn": "小限",
"rat": "",
"ox": "",
"tiger": "",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/zh-TW/common.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"decadal": "大限",
"yearly": "流年",
"monthly": "流月",
"daily": "流日",
"hourly": "流時",
"turn": "小限",
"rat": "",
"ox": "",
"tiger": "",
Expand Down

0 comments on commit b39dc30

Please sign in to comment.