Add entity translations to Github (#95404)
This commit is contained in:
parent
286bdff8bc
commit
dd3693caca
2 changed files with 52 additions and 12 deletions
|
@ -47,7 +47,7 @@ class GitHubSensorEntityDescription(BaseEntityDescription, BaseEntityDescription
|
|||
SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
||||
GitHubSensorEntityDescription(
|
||||
key="discussions_count",
|
||||
name="Discussions",
|
||||
translation_key="discussions_count",
|
||||
native_unit_of_measurement="Discussions",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -55,7 +55,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="stargazers_count",
|
||||
name="Stars",
|
||||
translation_key="stargazers_count",
|
||||
icon="mdi:star",
|
||||
native_unit_of_measurement="Stars",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -64,7 +64,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="subscribers_count",
|
||||
name="Watchers",
|
||||
translation_key="subscribers_count",
|
||||
icon="mdi:glasses",
|
||||
native_unit_of_measurement="Watchers",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -73,7 +73,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="forks_count",
|
||||
name="Forks",
|
||||
translation_key="forks_count",
|
||||
icon="mdi:source-fork",
|
||||
native_unit_of_measurement="Forks",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -82,7 +82,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="issues_count",
|
||||
name="Issues",
|
||||
translation_key="issues_count",
|
||||
native_unit_of_measurement="Issues",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -90,7 +90,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="pulls_count",
|
||||
name="Pull requests",
|
||||
translation_key="pulls_count",
|
||||
native_unit_of_measurement="Pull Requests",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -98,7 +98,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="latest_commit",
|
||||
name="Latest commit",
|
||||
translation_key="latest_commit",
|
||||
value_fn=lambda data: data["default_branch_ref"]["commit"]["message"][:255],
|
||||
attr_fn=lambda data: {
|
||||
"sha": data["default_branch_ref"]["commit"]["sha"],
|
||||
|
@ -107,7 +107,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="latest_discussion",
|
||||
name="Latest discussion",
|
||||
translation_key="latest_discussion",
|
||||
avabl_fn=lambda data: data["discussion"]["discussions"],
|
||||
value_fn=lambda data: data["discussion"]["discussions"][0]["title"][:255],
|
||||
attr_fn=lambda data: {
|
||||
|
@ -117,7 +117,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="latest_release",
|
||||
name="Latest release",
|
||||
translation_key="latest_release",
|
||||
avabl_fn=lambda data: data["release"] is not None,
|
||||
value_fn=lambda data: data["release"]["name"][:255],
|
||||
attr_fn=lambda data: {
|
||||
|
@ -127,7 +127,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="latest_issue",
|
||||
name="Latest issue",
|
||||
translation_key="latest_issue",
|
||||
avabl_fn=lambda data: data["issue"]["issues"],
|
||||
value_fn=lambda data: data["issue"]["issues"][0]["title"][:255],
|
||||
attr_fn=lambda data: {
|
||||
|
@ -137,7 +137,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="latest_pull_request",
|
||||
name="Latest pull request",
|
||||
translation_key="latest_pull_request",
|
||||
avabl_fn=lambda data: data["pull_request"]["pull_requests"],
|
||||
value_fn=lambda data: data["pull_request"]["pull_requests"][0]["title"][:255],
|
||||
attr_fn=lambda data: {
|
||||
|
@ -147,7 +147,7 @@ SENSOR_DESCRIPTIONS: tuple[GitHubSensorEntityDescription, ...] = (
|
|||
),
|
||||
GitHubSensorEntityDescription(
|
||||
key="latest_tag",
|
||||
name="Latest tag",
|
||||
translation_key="latest_tag",
|
||||
avabl_fn=lambda data: data["refs"]["tags"],
|
||||
value_fn=lambda data: data["refs"]["tags"][0]["name"][:255],
|
||||
attr_fn=lambda data: {
|
||||
|
|
|
@ -15,5 +15,45 @@
|
|||
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]",
|
||||
"could_not_register": "Could not register integration with GitHub"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"discussions_count": {
|
||||
"name": "Discussions"
|
||||
},
|
||||
"stargazers_count": {
|
||||
"name": "Stars"
|
||||
},
|
||||
"subscribers_count": {
|
||||
"name": "Watchers"
|
||||
},
|
||||
"forks_count": {
|
||||
"name": "Forks"
|
||||
},
|
||||
"issues_count": {
|
||||
"name": "Issues"
|
||||
},
|
||||
"pulls_count": {
|
||||
"name": "Pull requests"
|
||||
},
|
||||
"latest_commit": {
|
||||
"name": "Latest commit"
|
||||
},
|
||||
"latest_discussion": {
|
||||
"name": "Latest discussion"
|
||||
},
|
||||
"latest_release": {
|
||||
"name": "Latest release"
|
||||
},
|
||||
"latest_issue": {
|
||||
"name": "Latest issue"
|
||||
},
|
||||
"latest_pull_request": {
|
||||
"name": "Latest pull request"
|
||||
},
|
||||
"latest_tag": {
|
||||
"name": "Latest tag"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue