Skip to content

Commit

Permalink
add te, ja languages
Browse files Browse the repository at this point in the history
  • Loading branch information
BesrourMS committed Nov 19, 2023
1 parent 0c3c18c commit 87f8eb0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ console.log(new ZodiacSign('1991-11-30').sign)
### Getting a chinese zodiac sign from a date

```js
// Return 'Fire Rat'
// Return {"sign": "Rat", "element": "Fire", "yinyang": "Yang"}
console.log(new ZodiacSign('1 Feb 1997 00:12:00 GMT').chinese)
```

Expand All @@ -35,12 +35,14 @@ console.log(new ZodiacSign('1 Feb 1997 00:12:00 GMT', 'ar').chinese);
```

## Translation
For the moment, the only available languages are English, French, Spanish, Arabic, Ukrainian and Chinese.
For the moment, the only available languages are English, French, Spanish, Arabic, Ukrainian, Chinese, Turkish and Japanese.
Fell free to participate to the translation in any other language.
### Available languages
- English (en)
- French (fr)
- Spanish (es)
- Arabic (ar)
- Ukrainian (ua)
- Chinese (zh)
- Chinese (zh)
- Turkish (tr)
- Japanese (ja)
17 changes: 12 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ class ZodiacSign {
es : ['Aries', 'Tauro', 'Géminis', 'Cáncer', 'Leo', 'Virgo', 'Libra', 'Escorpio', 'Sagitario', 'Capricornio', 'Acuario', 'Piscis'],
ar : ['الحمل', 'الثور', 'الجوزاء', 'السرطان', 'الأسد', 'العذراء', 'الميزان', 'العقرب',' القوس', 'الجدي', 'الدلو', 'الحوت'],
ua : ['Овен', 'Телець', 'Близнята', 'Рак', 'Лев', 'Діва', 'Терези', 'Скорпіон', 'Стрілець', 'Козоріг', 'Водолій', 'Риби'],
zh : ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '人马座', '山羊座', '宝瓶座', '双鱼座']
zh : ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '人马座', '山羊座', '宝瓶座', '双鱼座'],
tr : ['Koç', 'Boğa', 'İkizler', 'Kanser', 'Aslan', 'Başak', 'Terazi', 'Akrep', 'Yay', 'Oğlak', 'Kova', 'Balık'],
ja : ['牡羊座', '牡牛座', '双子座', '蟹座', '獅子座', '乙女座', '天秤座', '蠍座', '射手座', '山羊座', '水瓶座', '魚座']
}

static chineseSigns = {
Expand All @@ -15,7 +17,9 @@ class ZodiacSign {
es : ['Mono', 'Gallo', 'Perro', 'Cerdo', 'Rata', 'Buey', 'Tigre', 'Conejo', 'Dragón', 'Serpiente', 'Caballo', 'Oveja'],
ar : ['القرد', 'الديك', 'الكلب', 'الخنزير', 'الفأر', 'الثور', 'النمر', 'الأرنب', 'التنين', 'الثعبان', 'الحصان', 'الخروف'],
ua : ['Мавпа', 'Півень', 'Собака', 'Свиня', 'Щур', 'Бик', 'Тигр', 'Кролик', 'Дракон', 'Змія', 'Кінь', 'Вівця'],
zh : ['猴', '鸡', '狗', '猪', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊']
zh : ['猴', '鸡', '狗', '猪', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊'],
tr : ['Maymun', 'Horoz', 'Köpek', 'Domuz', 'Sıçan', 'Öküz', 'Kaplan', 'Tavşan', 'Ejderha', 'Yılan', 'At', 'Koyun'],
ja : ['猿', '鶏', '犬', '猪', 'ネズミ', '牛', '虎', '兎', '龍', '蛇', '馬', '羊']
}

static chineseElements = {
Expand All @@ -24,7 +28,9 @@ class ZodiacSign {
es : ['Metal', 'Agua', 'Madera', 'Fuego', 'Tierra'],
ar : ['المعدني', 'المائي', 'الخشبي', 'الناري', 'الأرضي'],
ua : ['Метал', 'Вода', 'Дерево', 'Вогонь', 'Земля'],
zh : ['金属', '水', '木头', '火灾', '地球']
zh : ['金属', '水', '木头', '火灾', '地球'],
tr : ['Metal', 'Su', 'Ahşap', 'Yangın', 'Dünya'],
ja : ['金', '水', '木', '火', '土']
}

static yinYang = {
Expand All @@ -33,7 +39,9 @@ class ZodiacSign {
es : ['Yang', 'Yin'],
ar : ['اليانغ', 'اليين'],
ua : ['Ян', 'Інь'],
zh : ['阳', '阴']
zh : ['阳', '阴'],
tr : ['Yang', 'Yin'],
ja : ['陽', '陰']
}

constructor(value, lang = 'en') {
Expand All @@ -54,7 +62,6 @@ class ZodiacSign {
#getChineseSign(x, y){
let chineseDate = new Intl.DateTimeFormat('fr-TN-u-ca-chinese', {day: '2-digit', month: 'long', year:'numeric'}).format(Date.parse(x)).substring(0, 4)


let chineseSign = {
"sign" : ZodiacSign.chineseSigns[y][+chineseDate % 12],
"element" : ZodiacSign.chineseElements[y][Math.floor(+chineseDate.charAt(3) / 2)],
Expand Down

0 comments on commit 87f8eb0

Please # to comment.