Skip to content

Translated developer tools events page#4033

Merged
bramkragten merged 3 commits into
home-assistant:devfrom
springstan:translateEventsPage
Oct 17, 2019
Merged

Translated developer tools events page#4033
bramkragten merged 3 commits into
home-assistant:devfrom
springstan:translateEventsPage

Conversation

@springstan
Copy link
Copy Markdown
Member

Issue affected: #3429

Description:

  • added developer tools events page translations to src/translations/en.json
  • updated developer-tools-event.js, event-subscribe-card.ts and events-list.js accordingly

Result:
grafik

Comment thread src/translations/en.json
"start_listening": "Start listening",
"stop_listening": "Stop listening",
"alert_event_type": "Event type is a mandatory field",
"notification_event_fired": "Event {type} successful fired!"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this one in your code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my bad. Not sure why I did not use start/stop_listening. Though I wanted to use alert_event_type and notification_event_fired in developer-tools-event.js here:

fireEvent() {
    if (!this.eventType) {
      alert("Event type is a mandatory field");
      return;
    }
    this.hass.callApi("POST", "events/" + this.eventType, this.parsedJSON).then(
      function() {
        this.fire("hass-notification", {
          message: "Event " + this.eventType + " successful fired!",
        });
      }.bind(this)
    );
  }

However, could not figure out how to use this.hass.localize() in this contex, the frontend always showed blank instead of the translated text.
Is there anything I have to take into account?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should work, what was your code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what I did wrong before, but now it works flawlessly. Updated my code with 923cfe7.

Copy link
Copy Markdown
Member

@bramkragten bramkragten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks! 🦁

…firing an event), Removed unnecessary translation key-value pairs
Comment thread src/translations/en.json Outdated
Comment on lines -1787 to -1788
"start_listening": "Start listening",
"stop_listening": "Stop listening",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two are used in event-subscribe-card.ts

Copy link
Copy Markdown
Member Author

@springstan springstan Oct 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry thought you linked to them as well and that I did not use them. Fixed with 4a1f602.

@bramkragten bramkragten merged commit 982966c into home-assistant:dev Oct 17, 2019
@bramkragten bramkragten mentioned this pull request Oct 23, 2019
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants