Skip to content

Commit

Permalink
🔨 Language not getting updated. This was not properly initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcHagen committed May 30, 2021
1 parent a7cc274 commit ac40492
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
### ✨ NEW
- Adding precipitation probability (if exists in weather object)

### 🔨 FIXED
- Language not getting updated. This was not properly initialized.

### 🧹 Cleanup
- Don't require sun

Expand Down
2 changes: 2 additions & 0 deletions src/localize/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as sv from './languages/sv.json';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const languages: any = {
en: en,
// eslint-disable-next-line @typescript-eslint/camelcase
en_GB: en,
da: da,
de: de,
es: es,
Expand Down
11 changes: 5 additions & 6 deletions src/weather-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ import './initialize';
export class WeatherCard extends LitElement {
// https://lit-element.polymer-project.org/guide/properties
@property({ attribute: false }) public hass!: HomeAssistant
@property({ attribute: false }) public chartData?: object;
@property({ attribute: false }) public chartData?: object

@state() private config!: WeatherCardConfig
@state() private weatherObj: HassEntity | null | undefined;
@state() private numberElements: number

private forecast?: WeatherObjectForecast[]
private mode: CardMode
private readonly currentLanguage: string;
private readonly currentLanguage: string

constructor() {
super();
super()
this.numberElements = 0
this.mode = CardMode.daily;
this.currentLanguage = this.hass?.language || 'en';
this.mode = CardMode.daily
this.currentLanguage = (localStorage.getItem('selectedLanguage') || 'en').replace(/['"]+/g, '');
}

public static async getConfigElement(): Promise<LovelaceCardEditor> {
Expand Down Expand Up @@ -381,7 +381,6 @@ export class WeatherCard extends LitElement {
duration: 300,
easing: 'linear',
onComplete: function (): void {
console.log('running animation completed')
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
const chartInstance = this.chart;
Expand Down

0 comments on commit ac40492

Please sign in to comment.