Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Added Chinese and Japanese #139

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Note: If you get an error similar to this `Custom element doesn't exist` you wil
| timeFormat | `'12h'`/`'24h'` | Displayed time format | Locale based on Home assistant language |
| title | `string` | Card title | Doesn't display a title by default | |

(<sup>1</sup>) Supported languages: `da`, `de`, `en`, `es`, `et`, `fi`, `fr`, `hu`, `it`, `nl`, `pl`, `pt-BR`, `ru`, `sl`, `sv`
(<sup>1</sup>) Supported languages: `da`, `de`, `en`, `es`, `et`, `fi`, `fr`, `hu`, `it`, `ja`, `nl`, `pl`, `pt-BR`, `ru`, `sl`, `sv`, `zh-Hans`, `zh-Hant`

## Known issues
- Home assistant seems to provide next events instead today's one
12 changes: 12 additions & 0 deletions src/assets/localization/languages/ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Azimuth": "方位角",
"Dawn": "明け方",
"Dusk": "夕",
"Elevation": "仰俯角",
"Noon": "太陽の正午",
"Sunrise": "日出",
"Sunset": "日沒",
"errors": {
"SunIntegrationNotFound": "インテグレーション Sun は検索できません"
}
}
12 changes: 12 additions & 0 deletions src/assets/localization/languages/zh-Hans.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Azimuth": "方位角",
"Dawn": "拂晓",
"Dusk": "傍晚",
"Elevation": "仰角",
"Noon": "日中",
"Sunrise": "日出",
"Sunset": "日落",
"errors": {
"SunIntegrationNotFound": "未搜索到集成 Sun"
}
}
12 changes: 12 additions & 0 deletions src/assets/localization/languages/zh-Hant.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Azimuth": "方位",
"Dawn": "黎明",
"Dusk": "黃昏",
"Elevation": "仰角",
"Noon": "日正當中",
"Sunrise": "日昇",
"Sunset": "日落",
"errors": {
"SunIntegrationNotFound": "沒有找到整合 Sun"
}
}
5 changes: 4 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import fi from './assets/localization/languages/fi.json'
import fr from './assets/localization/languages/fr.json'
import hu from './assets/localization/languages/hu.json'
import it from './assets/localization/languages/it.json'
import ja from './assets/localization/languages/ja.json'
import nl from './assets/localization/languages/nl.json'
import pl from './assets/localization/languages/pl.json'
import ptBR from './assets/localization/languages/pt-BR.json'
import ru from './assets/localization/languages/ru.json'
import sl from './assets/localization/languages/sl.json'
import sv from './assets/localization/languages/sv.json'
import zh_Hans from './assets/localization/languages/zh-Hans.json'
import zh_Hant from './assets/localization/languages/zh-Hant.json'
import { TSunCardConfig, TSunCardTexts } from './types'

export class Constants {
Expand All @@ -33,7 +36,7 @@ export class Constants {

static readonly HORIZON_Y = 108
static readonly LOCALIZATION_LANGUAGES: Record<string, TSunCardTexts> = {
da, de, en, es, et, fi, fr, hu, it, nl, pl, 'pt-BR': ptBR, ru, sl, sv
da, de, en, es, et, fi, fr, hu, it, ja, nl, pl, 'pt-BR': ptBR, ru, sl, sv, 'zh-Hans': zh_Hans, 'zh-Hant': zh_Hant
}
static readonly SUN_RADIUS = 17
}