Skip to content

Commit

Permalink
Fix moon phase translation key
Browse files Browse the repository at this point in the history
  • Loading branch information
trvrnrth authored and ThomDietrich committed May 21, 2024
1 parent b169c1e commit 7687e0d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/utils/HelperFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class HelperFunctions {
return nothing
}

let moon_phase_localized: unknown = i18n.localize(`component.entity.sensor.phase.state.${phase.state}`)
let moon_phase_localized: unknown = i18n.localize(`component.moon.entity.sensor.phase.state.${phase.state}`)
if (!moon_phase_localized) {
moon_phase_localized = html`<span title="Install Moon integration to get localized Moon phase name">${phase.state} (!)</span>`
}
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/components/horizonCard/HorizonCardFooter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NumberFormat, TimeFormat } from 'custom-card-helpers'

import { HorizonCardFooter } from '../../../../src/components/horizonCard'
import { Constants } from '../../../../src/constants'
import { IHorizonCardConfig, THorizonCardData } from '../../../../src/types'
import { I18N } from '../../../../src/utils/I18N'
import { TemplateResultTestHelper } from '../../../helpers/TestHelpers'
Expand Down Expand Up @@ -61,7 +62,7 @@ describe('HorizonCardFooter', () => {
if (field.startsWith('moon_')) {
const name = field.substring('moon_'.length)
if (name === 'phase') {
data.moonData[name] = 'full_moon'
data.moonData[name] = Constants.MOON_PHASES.fullMoon
data.moonData['phaseRotation'] = 0
} else {
data.moonData[name] = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ exports[`HorizonCardFooter render should render the moon_phase field when it is
<div class="horizon-card-field-moon-phase"
style="transform: rotate(0deg)"
>
<ha-icon icon="mdi:">
<ha-icon icon="mdi:moon-full">
</ha-icon>
</div>
<div class="horizon-card-field-value horizon-card-field-value-moon-phase">
component.sensor.state.moon__phase.undefined
component.moon.entity.sensor.phase.state.full_moon
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`HelperFunctions renderFieldElement returns a field element template whe
</ha-icon>
</div>
<div class="horizon-card-field-value horizon-card-field-value-moon-phase">
component.sensor.state.moon__phase.full_moon
component.moon.entity.sensor.phase.state.full_moon
</div>
</div>
`;
Expand Down

0 comments on commit 7687e0d

Please sign in to comment.