Skip to content

Commit 7687e0d

Browse files
trvrnrthThomDietrich
authored andcommitted
Fix moon phase translation key
1 parent b169c1e commit 7687e0d

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/utils/HelperFunctions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class HelperFunctions {
2929
return nothing
3030
}
3131

32-
let moon_phase_localized: unknown = i18n.localize(`component.entity.sensor.phase.state.${phase.state}`)
32+
let moon_phase_localized: unknown = i18n.localize(`component.moon.entity.sensor.phase.state.${phase.state}`)
3333
if (!moon_phase_localized) {
3434
moon_phase_localized = html`<span title="Install Moon integration to get localized Moon phase name">${phase.state} (!)</span>`
3535
}

tests/unit/components/horizonCard/HorizonCardFooter.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NumberFormat, TimeFormat } from 'custom-card-helpers'
22

33
import { HorizonCardFooter } from '../../../../src/components/horizonCard'
4+
import { Constants } from '../../../../src/constants'
45
import { IHorizonCardConfig, THorizonCardData } from '../../../../src/types'
56
import { I18N } from '../../../../src/utils/I18N'
67
import { TemplateResultTestHelper } from '../../../helpers/TestHelpers'
@@ -61,7 +62,7 @@ describe('HorizonCardFooter', () => {
6162
if (field.startsWith('moon_')) {
6263
const name = field.substring('moon_'.length)
6364
if (name === 'phase') {
64-
data.moonData[name] = 'full_moon'
65+
data.moonData[name] = Constants.MOON_PHASES.fullMoon
6566
data.moonData['phaseRotation'] = 0
6667
} else {
6768
data.moonData[name] = 0

tests/unit/components/horizonCard/__snapshots__/HorizonCardFooter.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ exports[`HorizonCardFooter render should render the moon_phase field when it is
192192
<div class="horizon-card-field-moon-phase"
193193
style="transform: rotate(0deg)"
194194
>
195-
<ha-icon icon="mdi:">
195+
<ha-icon icon="mdi:moon-full">
196196
</ha-icon>
197197
</div>
198198
<div class="horizon-card-field-value horizon-card-field-value-moon-phase">
199-
component.sensor.state.moon__phase.undefined
199+
component.moon.entity.sensor.phase.state.full_moon
200200
</div>
201201
</div>
202202
</div>

tests/unit/utils/__snapshots__/HelperFunctions.spec.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ exports[`HelperFunctions renderFieldElement returns a field element template whe
2525
</ha-icon>
2626
</div>
2727
<div class="horizon-card-field-value horizon-card-field-value-moon-phase">
28-
component.sensor.state.moon__phase.full_moon
28+
component.moon.entity.sensor.phase.state.full_moon
2929
</div>
3030
</div>
3131
`;

0 commit comments

Comments
 (0)