File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ Install card-tools [by adding card-tools.js to your lovelace resources](https://
3131| showFrom | boolean | true | Whether to show the departing station or not |
3232| showTo | boolean | false | Whether to show the arriving station or not |
3333| showDir | boolean | false | Whether to show the destination station or not |
34+ | language | string | null | User defined language to use in the card. Overrides system lanaguage
3435
3536## Municipality
3637
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ customElements.whenDefined('card-tools').then(() => {
7272 this . showTo = config . showTo !== undefined ? ! ! ( config . showTo ) : false ;
7373 this . showDir = config . showDir !== undefined ? ! ! ( config . showDir ) : false ;
7474 this . municipality = config . municipality || 'Göteborg' ;
75+ this . userDefinedLanguage = config . language ;
7576 this . entities = this . _parseEntities ( config . entities ) ;
7677 this . config = config ;
7778 }
@@ -157,7 +158,7 @@ customElements.whenDefined('card-tools').then(() => {
157158 const line = attributes . line ;
158159 const lineClass = this . _getLineClass ( line ) ;
159160 const departureTime = hassEntity . state ;
160- const timeUntilLeave = this . _getTimeUntil ( hassEntity ) ;
161+ const timeUntilLeave = Math . abs ( this . _getTimeUntil ( hassEntity ) , 0 ) ;
161162 const from = attributes . from || '' ;
162163 const heading = attributes . to || '' ;
163164 const direction = attributes . direction || '' ;
@@ -195,7 +196,7 @@ customElements.whenDefined('card-tools').then(() => {
195196 }
196197
197198 _getTranslatedText ( textKey ) {
198- let language = this . hass ?. language || 'en' ;
199+ let language = this . userDefinedLanguage || this . hass ?. language || 'en' ;
199200 if ( ! this . translations . hasOwnProperty ( language ) ) {
200201 console . debug ( `Language "${ language } " is not configured, using english instead` ) ;
201202 language = 'en' ;
You can’t perform that action at this time.
0 commit comments